In C, what keyword is used to define a structure?

The story behind the answer

In C, the keyword used to define a structure is `struct`.

A structure is a user-defined composite type that groups related values, potentially of different types, under one name. For example, `struct Book { char title[100]; int pages; };` defines a structure with a character array and an integer member. Each member has a defined position within the object, although compilers may insert padding for alignment.

The word `struct` is part of the declaration syntax, so an object is commonly declared as `struct Book novel;`. This differs from `typedef`, which creates an alternate name for an existing type rather than defining the structure itself. `enum` defines a set of named integer constants, while `union` stores different members in shared memory.

C structures descend from similar record-like features in earlier languages, including ALGOL 68. They are widely used for records, linked lists, configuration objects, and data exchanged with operating-system interfaces. A `typedef` can later provide a shorter name, but `struct` remains the canonical keyword for the structure declaration.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: