Skip to main content

Structures for C Programmings

Structures group related values under one type, while unions let several members share the same memory. Together with pointers they let you build data structures in C, such as linked lists, stacks, queues and trees, since the language has no built-in collections beyond arrays.

Stage: Memory · Part of the C Programming roadmap · Last reviewed 19 November 2026

What to learn in Structures

Structures interview questions

Why can sizeof a struct be larger than the sum of its members?

The compiler inserts padding so each member sits at an address aligned to its type, which the hardware handles efficiently. Ordering members from largest to smallest alignment can reduce padding, though layout rules depend on the platform.

How do you free a linked list correctly?

Walk the list, saving the next pointer before calling free on the current node, then advance using the saved pointer. Freeing first and reading next afterwards uses freed memory. Finally set the head to NULL.

Where Structures fits in the C Programming roadmap

Structures belongs to the Memory stage (intermediate level), which takes about 30 hours. Pointers and the heap.

Back to the full C Programming roadmap