Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program for size of a data type without using
sizeof() operator?

Answer Posted / learner

#include<stdio.h>
void main()
{
char *ptr1,*ptr2;
char fl;//float,double,int
ptr1 = &fl;//it will take the address of f1
ptr2 = (&fl+1);//it wil increment the address with according thr memory size

printf("%u",(char *)ptr2-(char *)ptr1);//explicit type casting for pointers
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is scope of variable in c?

1046


What is cohesion and coupling in c?

1038


can anyone suggest some site name..where i can get some good data structure puzzles???

2087


What is a spanning Tree?

1599


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

1151


What are the 5 organizational structures?

1033


Explain about C function prototype?

1102


Write a code to generate a series where the next element is the sum of last k terms.

1229


how to introdu5ce my self in serco

2010


What is the difference between ++a and a++?

1221


can we change the default calling convention in c if yes than how.........?

2541


What is bubble sort in c?

1058


How can I read in an object file and jump to locations in it?

1035


Is main a keyword in c?

1138


What are header files and explain what are its uses in c programming?

1135