C CLP study materials
C CLP study resources

C CLP flashcards

C CLP · Build recall with a focused review session.

32 cards. Read the term and the definition here. The deck at the top of this page is optional.

Translation unit
A source file after preprocessing, including all expanded headers and macro substitutions, submitted as one unit to the compiler. Each .c file plus its includes forms one translation unit.
Stringize operator #
Inside a function-like macro, `#param` converts the argument's preprocessing tokens into a string literal without expanding macros inside the argument first. Only valid in macro replacement lists.
Token pasting ##
The `##` operator concatenates two adjacent preprocessing tokens into one during macro expansion, forming a new identifier or number. Arguments are macro-expanded before pasting unless preceded by `#`.
Include guard
A conditional block using `#ifndef GUARD`, `#define GUARD`, and `#endif` around a header's contents so repeated inclusion in one translation unit has no effect after the first time.
Integer promotions
Any integer type with rank lower than int is converted to int, or to unsigned int if int cannot represent all its values, before use in arithmetic or as a variadic argument.
Usual arithmetic conversions
Operands of a binary operator are converted to a common type: after integer promotions, the higher-ranked type wins; if signedness differs at equal rank, unsigned generally prevails.
const qualifier
Declares an object whose value cannot be modified through that lvalue after initialization. It does not imply the underlying storage is immutable if other non-const access paths exist.
Tentative definition
A file-scope declaration without initializer such as `int x;`. If no full definition appears in the translation unit, it becomes a definition with zero initialization at end of translation.
Short-circuit evaluation
The `&&` and `||` operators evaluate the left operand first and skip the right operand when the result is already determined, introducing a sequence point between them.
Sequence point
A point in evaluation where all side effects of previous evaluations are complete and none of subsequent ones have occurred, such as after `&&`, `||`, `?:`, comma, or a full expression.
Undefined behavior example
Modifying an object more than once between sequence points, as in `i = i++ + 1`, or signed integer overflow, or dereferencing a null pointer; the standard imposes no requirements on the result.
Conditional operator
`cond ? a : b` evaluates cond first, then only one of a or b, and yields that value converted to the common type of a and b. It is not a statement and does not short-circuit like &&.
switch fallthrough
Control passes from one case label into the following statements and labels unless a break, return, goto, or continue exits. Multiple case labels can share one body deliberately.
do-while loop
Executes its body once before testing the controlling expression, so the body always runs at least once. The condition is tested after each iteration and must end with a semicolon.
continue statement
Skips the remaining statements of the innermost enclosing loop body and proceeds to the next iteration: in a for loop it jumps to the step expression, in while/do to the condition.
goto restrictions
A goto may only jump to a label in the same function. It may not jump into the scope of a variable-length array, and jumping over a declaration with initializer can leave it uninitialized.
static at file scope
Gives the declared identifier internal linkage, so the name is visible only within its translation unit and cannot conflict with same-named external symbols in other object files.
static local variable
A block-scope object with static storage duration: it is initialized once before program startup, retains its value between calls, and has no linkage.
Pass by value
C always passes arguments by value; the function receives copies. To let a function modify a caller's object, pass its address and dereference the pointer inside the function.
Default argument promotions
For variadic or unprototyped calls, float promotes to double and integer types narrower than int promote to int or unsigned int. Mismatches in printf arguments cause undefined behavior.
Array-to-pointer decay
Except as the operand of sizeof, &, or a string literal initializer, an array expression converts to a pointer to its first element, losing the array's length information.
One-past-the-end pointer
A pointer to the element just after the last array element is valid to form and compare, but dereferencing it is undefined behavior. It is commonly used as an end iterator.
Pointer to array
`int (*p)[4]` points to an entire four-element int array; incrementing it advances by 16 bytes. Distinct from `int *p[4]`, an array of four int pointers.
Null pointer constant
An integer constant expression with value zero, or such an expression cast to void *, used to represent a null pointer. NULL expands to one; dereferencing it is undefined behavior.
strncpy termination caveat
strncpy copies at most n characters and pads with nulls only if the source is shorter than n; if the source length is at least n, the destination is not null-terminated.
ctype argument requirement
Functions in <ctype.h> require an argument representable as unsigned char or equal to EOF. Passing a negative char value, common with signed char, is undefined behavior.
String literal storage
A string literal has static storage duration and is an array of char (or wchar_t) including the terminator. Attempting to modify it through a pointer is undefined behavior.
realloc semantics
Changes an allocation's size, possibly moving it and returning a new pointer; on success the old pointer is invalid and its contents are preserved up to the smaller size. On failure the old block remains valid.
Dangling pointer
A pointer whose referenced storage has been freed or gone out of scope. Reading or writing through it is undefined behavior; assigning NULL after free prevents accidental reuse.
Struct padding
Compilers insert unnamed bytes between members and at the end so each member meets its alignment requirement, so sizeof a struct can exceed the sum of its members' sizes.
Bit-field constraints
A bit-field's width must be a nonnegative integer constant not exceeding the width of its declared type. Its layout, ordering, and alignment are implementation-defined, and its address cannot be taken.
fgets behavior
Reads at most n-1 characters or up to and including a newline, then appends a null terminator. Returns NULL on error or end-of-file before any character is read.