C CLP study materials
C CLP study resources

C CLP key terms

C CLP · Get comfortable with the vocabulary.

translation unit

The complete source text a compiler processes in one pass: a source file after preprocessing, with all #include files expanded and all macros replaced. Separate translation units are later combined by the linker.

Related: preprocessor, linkage
preprocessor directive

A line beginning with # that the preprocessor handles before compilation, such as #include, #define, #if, or #pragma. Directives are not C statements and do not end with a semicolon.

Related: macro expansion, include guard
macro expansion

The textual substitution the preprocessor performs for an object-like or function-like macro. Arguments are substituted textually, not evaluated, so parentheses and side-effect caution are essential.

Related: preprocessor directive, stringizing operator
include guard

A conditional pattern using #ifndef, #define, and #endif around a header's contents so that repeated inclusion in one translation unit does not redeclare the same types or macros.

Related: preprocessor directive, translation unit
stringizing operator

The # token inside a macro definition that converts the corresponding argument into a string literal without evaluating it. It is applied before the ## token-pasting operator.

Related: macro expansion, token pasting
token pasting

The ## operator inside a macro definition that glues the text of two adjacent tokens into a single token, commonly used to build identifier names from macro arguments.

Related: stringizing operator, macro expansion
object representation

The sequence of bytes a particular implementation uses to store a value of a type. It may include padding bits and differs from the value representation, which describes meaningful bits.

Related: alignment, strict aliasing
integer conversion rank

An ordering of integer types by precision where long long ranks above long, long above int, and so on. The rank decides which operand is converted in usual arithmetic conversions.

Related: usual arithmetic conversions, integer promotion
integer promotion

The automatic conversion of a small integer type such as char, short, or an enumeration to int or unsigned int before use in arithmetic or as a variadic argument.

Related: integer conversion rank, usual arithmetic conversions
usual arithmetic conversions

The rules that bring two operands of a binary arithmetic operator to a common type, based on rank, signedness, and whether the unsigned type can represent all values of the signed one.

Related: integer promotion, integer conversion rank
strict aliasing

The rule that an object may normally be accessed only through an lvalue of its own type, a qualified version, a signed or unsigned counterpart, an aggregate containing it, or a character type. Violating it permits aggressive optimization.

Related: object representation, effective type
effective type

For dynamically allocated objects, the type established by the last store into the object, or the declared type of a copied source. It constrains which lvalues may legally access the storage.

Related: strict aliasing, malloc
sequence point

A point in program execution where all side effects of previous evaluations are complete and none of subsequent evaluations have begun. The C standard specifies a finite set of such points.

Related: undefined behavior, short-circuit evaluation
short-circuit evaluation

The guarantee that the right operand of && is not evaluated when the left is false, and the right operand of || is not evaluated when the left is true. The comma and conditional operators also impose ordering.

Related: sequence point, conditional operator
lvalue

An expression that designates an object and may appear on the left of an assignment, though not all lvalues are modifiable. Arrays and const-qualified objects are non-modifiable lvalues.

Related: rvalue, address-of operator
conditional operator

The ternary operator ?: that evaluates its first operand, then exactly one of the other two, and yields a value converted to their common type. It is not an lvalue in C.

Related: short-circuit evaluation, lvalue
comma operator

An operator that evaluates its left operand, discards the result, then evaluates the right operand and yields that value. It introduces a sequence point between the operands.

Related: sequence point, short-circuit evaluation
undefined behavior

Behavior for which the C standard imposes no requirements, such as signed overflow or dereferencing a null pointer. Compilers may assume it never occurs and optimize accordingly.

Related: sequence point, strict aliasing
dangling else

The ambiguity in nested if statements where an else binds to the nearest unmatched if. Braces should be used to make the intended association explicit.

Related: compound statement, switch statement
switch statement

A selection statement that transfers control to a case label matching the controlling integer expression. Without break, execution falls through into subsequent cases.

Related: dangling else, compound statement
compound statement

A brace-enclosed sequence of declarations and statements that forms a block and introduces a new scope. It may be used anywhere a single statement is permitted.

Related: scope, dangling else
variadic function

A function declared with an ellipsis in its parameter list that accepts a variable number of arguments. The callee retrieves them with va_start, va_arg, and va_end from stdarg.h.

Related: default argument promotions, function prototype
default argument promotions

The conversions applied to arguments of a variadic function or a function without a prototype: float becomes double, and small integer types are promoted to int or unsigned int.

Related: variadic function, integer promotion
function prototype

A declaration that specifies a function's return type and parameter types, enabling the compiler to check calls and apply correct conversions. It ends with a semicolon and contains no body.

Related: variadic function, linkage
linkage

The property determining whether an identifier declared in one translation unit denotes the same entity as one declared in another. External linkage is shared; internal and no linkage are not.

Related: storage duration, static storage duration
storage duration

The lifetime category of an object: automatic, static, or allocated. It determines when storage is reserved and released, independent of the identifier's scope.

Related: linkage, static storage duration
static storage duration

Storage that exists for the entire execution of the program. Objects at file scope, and local objects declared with static, are zero-initialized before program startup.

Related: storage duration, linkage
scope

The region of program text in which an identifier is visible. C defines block, file, function prototype, and function scopes; inner declarations can hide outer ones.

Related: storage duration, compound statement
array-to-pointer decay

The implicit conversion of an array expression, except as the operand of sizeof, _Alignof, or the address-of operator, to a pointer to its first element when used in most contexts.

Related: pointer arithmetic, multidimensional array
pointer arithmetic

Addition or subtraction on a pointer scaled by the size of the pointed-to type. The result is defined only within the same array object or one past its final element.

Related: array-to-pointer decay, one-past-the-end pointer
one-past-the-end pointer

A pointer to the element immediately after the last element of an array. It may be formed and compared, but dereferencing it is undefined behavior.

Related: pointer arithmetic, undefined behavior
multidimensional array

An array whose elements are themselves arrays. Its name decays to a pointer to the first row, so a parameter must declare the trailing dimensions, as in int a[][4].

Related: array-to-pointer decay, pointer arithmetic
null-terminated string

A sequence of characters stored in a char array and terminated by a null character. Library functions such as strlen and strcpy rely on this terminator to find the end.

Related: strcpy, string literal
string literal

A double-quoted sequence of characters that denotes a static array of char, including an implicit terminating null. Modifying one through a pointer is undefined behavior.

Related: null-terminated string, strcpy
strcpy

A standard library function that copies a null-terminated source string into a destination buffer. It performs no bounds checking, so the destination must be large enough.

Related: null-terminated string, buffer overflow
buffer overflow

Writing past the end of an allocated array or buffer, corrupting adjacent memory. It is a common source of crashes and security vulnerabilities in C programs.

Related: strcpy, malloc
malloc

A standard library function that allocates a block of uninitialized storage of a requested size and returns a pointer to it, or a null pointer on failure.

Related: free, effective type
free

A library function that releases storage previously obtained from malloc, calloc, or realloc. Freeing the same pointer twice, or freeing a non-heap address, is undefined behavior.

Related: malloc, dangling pointer
dangling pointer

A pointer that still holds the address of storage that has been freed or has gone out of scope. Dereferencing it is undefined behavior even if the memory appears intact.

Related: free, use after free
use after free

Accessing memory through a pointer after the pointed-to block has been released. The behavior is undefined and often silently corrupts unrelated data.

Related: dangling pointer, free
alignment

A requirement that an object's address be a multiple of some power of two, determined by its type. Misaligned access may be slow or illegal depending on the platform.

Related: object representation, bit-field
bit-field

A structure member declared with an explicit width in bits. Layout and ordering are implementation-defined, and the address-of operator cannot be applied to a bit-field.

Related: alignment, union
union

A type whose members share the same storage, so only one member's value is meaningful at a time. Reading a member other than the last written is implementation-defined except in specific cases.

Related: bit-field, alignment
enumeration constant

A named integer constant declared inside an enum. Its type is int in C, and successive constants increase by one unless explicitly assigned.

Related: integer promotion, union
fopen

A standard library function that opens a file in a specified mode such as "r" or "wb" and returns a FILE pointer, or a null pointer if the open fails.

Related: fclose, fseek
fclose

A library function that flushes buffered output and releases the resources associated with a FILE stream. Failing to close streams can lose buffered data.

Related: fopen, fflush
fseek

A library function that repositions a stream's file position indicator using an offset and one of SEEK_SET, SEEK_CUR, or SEEK_END. It requires a seekable stream.

Related: fopen, fflush