Wednesday 14 October 2015

How to find the size of a structure without using sizeof operartor in C ?

To find the size of structure without using sizeof operator

Here's the program: 

struct Sample{
int a;
char b;
float c;

};

int main(){

struct Sample *ptr = (struct Sample *)0;
ptr++;
printf("Size of the structure is : %d",*ptr);

return 0;
}


No comments:

Post a Comment