C Programming Language Union in C Language
⚠ Report Question ✓ Question Verified
#include int main() { struct node { int data; struct node *link; }; struct node *p, *q; p = (struct node *) malloc(sizeof(struct node)); q = (struct node *) malloc(sizeof(struct node)); printf("%d, %d\n", sizeof(p), sizeof(q)); return 0; }
Learn More MCQ Questions from C Programming Language Union in C Language
Union is an user defined datatype in C programming language. It is a collection of variables of different datatypes in the same memory location. We can define a union with many members, but at a given point of time only one member can contain a value. Unions can be very handy when you need to talk to peripherals through some memory mapped registers.