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

Which is better oop or procedural?

1002


how to write a c program to print list of fruits in alpabetical order?

2248


How can I change the size of the dynamically allocated array?

1106


How do you generate random numbers in C?

1157


What are the types of i/o functions?

1269


Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent

2085


I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...

10156


What are terms in math?

990


Write a program that accept anumber in words

1717


All technical questions

1935


State two uses of pointers in C?

1013


what do u mean by Direct access files? then can u explain about Direct Access Files?

2047


Explain what are preprocessor directives?

1026


Explain why can’t constant values be used to define an array’s initial size?

1317


What is a char c?

998