struct t{};

int main(){
struct t a,b,c;
int l;
printf("%u %u %u %u\n",&a,&b,&c,&l);
}

o/p 
3213845680 3213845680 3213845680 3213845676

a,b,c all are pointing to same location, so no space is allocated to them.
As i already mentioned, "*may be*" . I dont know what standard says about it 
or rather i havent come across any such reference. These are just my 
thoughts on why it must be mandatory to allocate space for structs in c++ ( 
so as to relate corresponding funciton of an object to unique object which 
in identified by its address.)
Apart sizeof() tell u the space required by that "type" which is completely 
consistent in case above ( 0 space).

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/w9C4ZD3r_3QJ.
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.

Reply via email to