Entrance Exams
Govt. Exams
Reading a union member that wasn't last written gives unpredictable results (garbage value or leftover bits from previous member).
An array of structures, where each structure contains a linked list (using self-referential pointers), is ideal for adjacency list representation.
typedef struct creates a type alias, allowing you to declare variables without using the 'struct' keyword each time.
A union is the appropriate choice when you need to store different data types but only one value at a time.
A flexible array member must be the last member of a structure. This is a C99 feature used for dynamic-sized arrays.
The correct syntax for typedef struct is: typedef struct { members } StructName;
#pragma pack(1) removes padding, making members occupy consecutive memory locations for compact storage.
Unions are primarily used in embedded systems to conserve memory by allowing multiple members to share the same memory location.
Both nested structure definitions (defining B inside A and declaring B as member) are valid in C.
In C, you can assign one structure variable to another of the same type, and all members are copied (shallow copy).