C Programming - Structures, Unions, Enums - Discussion

Discussion Forum : Structures, Unions, Enums - Yes / No Questions (Q.No. 5)
5.
A pointer union CANNOT be created
Yes
No
Answer: Option
Explanation:
No answer description is available. Let's discuss.
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".
(1)

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.

Sachin said:   1 decade ago
It is having only one address ie longest size of data member then no need to have the pointer...

Naresh said:   1 decade ago
What will happen if we create pointer of single data type, in this case pointer can be created?

CBee said:   1 decade ago
It is possible to create union of pointers
union u{
int *p;
int *q;
char r[4];
};

Pradip Walghude said:   1 decade ago
Union allocates memory big data type variable. All variable memory is always same.

Varun said:   1 decade ago
But not in all cases. Union doesn't work as structure. @vaibhav.

Divya said:   1 decade ago
Can anyone explain with an example ?

Ashwin said:   9 years ago
Union is a self Referential pointer.

Deepthi said:   9 years ago
Can anyone give clear explanation?


Post your comments here:

Your comments will be displayed after verification.