C Programming - Structures, Unions, Enums - Discussion
Discussion Forum : Structures, Unions, Enums - Yes / No Questions (Q.No. 5)
5.
A pointer union CANNOT be created
Discussion:
16 comments Page 1 of 2.
Praphulla said:
1 decade ago
@Vaibhav & @Varun:
As externally, both paradigm looks same but internally work of both of them is completely different.
So in another way we can say:
"union are as like structure but not in all cases".
As externally, both paradigm looks same but internally work of both of them is completely different.
So in another way we can say:
"union are as like structure but not in all cases".
(1)
Niraimathi said:
1 decade ago
Can any one explain it why?
Vinay said:
1 decade ago
I am confused about the answer but it may be correct.
As union size is the size of its longest variable and all members access the same memory no need of assigning a pointer as we have only one memory address.
As union size is the size of its longest variable and all members access the same memory no need of assigning a pointer as we have only one memory address.
Sachin said:
1 decade ago
It is having only one address ie longest size of data member then no need to have the pointer...
Divya said:
1 decade ago
Can anyone explain with an example ?
Shanmuk said:
1 decade ago
No clarity.
CBee said:
1 decade ago
It is possible to create union of pointers
union u{
int *p;
int *q;
char r[4];
};
union u{
int *p;
int *q;
char r[4];
};
Vaibhav said:
1 decade ago
Union is work same as structure.
Varun said:
1 decade ago
But not in all cases. Union doesn't work as structure. @vaibhav.
Pradip Walghude said:
1 decade ago
Union allocates memory big data type variable. All variable memory is always same.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers