@rahul sharma
struct a
{ int a;
float b;
char c;
}b;
printf("%d",sizeof(b));
when u declare a struct variable (b in this case)...4 bytes are used for int
a,4 for float b and similarly 4 bytes for char c(though only 1 byte is
actually used).
but now look at following code..
struct a
{ double a;
float b;
char c;
}b;
printf("%d",sizeof(b));
in this case u get the output 16 and not 24...because 8 bytes are used for
double a,and in next 8 bytes 4 bytes are used for float b and char c each.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.