Skip to content
UPEEC

Data Structures in C

Arrays, strings, structures, unions, enums and typedefs — how C groups data. Structures/unions and bit fields also have their own pages.

Easy
Comments 0

This is an overview — pick a sub-topic below.

Sub-topics (10)

Arrays in C

Fixed-size sequences of elements of one type, stored contiguously.

Beginner♥ 0🔖 0💬 0

Strings in C

Arrays of `char` ending with a null byte `'\0'`.

Beginner♥ 0🔖 0💬 0

String Library (string.h)

`strlen`, `strcpy`, `strncpy`, `strcat`, `strcmp`, `strchr`, `strstr`, `memcpy`, `memset`, `memcmp`.

Easy♥ 0🔖 0💬 0

Structures

Group related fields into one type.

Beginner♥ 0🔖 0💬 0

Unions

Fields that share the same memory — only one is valid at a time.

Easy♥ 0🔖 0💬 0

Enumerations

Named integer constants.

Beginner♥ 0🔖 0💬 0

typedef

Gives an existing type a new name.

Beginner♥ 0🔖 0💬 0

Flexible Array Members

A struct whose last member is an array of unknown size, allocated together with the struct.

Intermediate♥ 0🔖 0💬 0

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.