Govt. Exams
Entrance Exams
Structures must be initialized at declaration time using curly braces. Assignment of initializer list is not valid after declaration.
The correct syntax for typedef struct is: typedef struct { members } StructName;
The arrow operator (->) is used to access structure members through a pointer. The dot operator is used with direct variables.
The size of a union equals the size of its largest member. Here, int is 4 bytes (largest), so union size is 4 bytes.
Union members share the same memory location, and the union size equals the size of its largest member.
struct Student { int roll; char name[50]; };
Correct allocation requires pointer declaration, proper cast, and multiplying n with sizeof(struct Student).
Pass by value creates a complete copy of the structure on the function's stack frame.
In C, self-referential structures require the struct keyword in pointer declarations within the structure definition.
Both methods are valid - A uses named struct tag with variable declaration, C uses anonymous struct with variable declaration.
Union size equals the largest member size. float is typically 4 bytes, which is largest.