Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

Knowledge base — C

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 472

C

SEEK_SET, SEEK_CUR, SEEK_END — seek origins

The SEEK_SET, SEEK_CUR, and SEEK_END macros select the reference point for fseek: the beginning, current position, or end of the file.

Basic · C23; repository compiler flag, production runtime not attested
C

Integer limits and widths in <stdint.h>

Macros from <stdint.h> describe integer ranges and bit widths. Use them to check portability and reject oversized calculations before evaluating them. C23 adds the macros ending in _WIDTH.

Intermediate · C23; repository compiler flag, production runtime not attested
C

stdio buffering constants

Macros from <stdio.h> select a stream's buffering mode and specify the buffer size for setbuf. Do not assume their numeric values.

Basic · C23; repository compiler flag, production runtime not attested
C

<stdio.h> limits

FOPEN_MAX, FILENAME_MAX, L_tmpnam, and TMP_MAX describe distinct guarantees, not one file limit.

Basic · C23; repository compiler flag, production runtime not attested
C

Callbacks in C: writing a `qsort` comparator

Pass a comparator as a typed function pointer, compare the full `int` range without overflow, and preserve the input order of records with equal keys.

Advanced · ISO C23; implementation support may vary
C

Callback dispatch tables in C

Map operation IDs to function pointers, call the selected callback indirectly, and distinguish an invalid index from a valid slot with no handler.

Advanced · ISO C23; implementation support may vary
C

FIFO queue with a circular buffer

Implement a fixed-capacity FIFO queue in an array using two indices and a count, so freed slots can be reused without shifting elements.

Advanced · ISO C23; implementation support may vary
C

Depth-first search (DFS) in C

Search a tree of groups recursively by checking each group's own items first, then its subgroups, and optionally save a pointer to the group containing the first match.

Advanced · ISO C23; implementation support may vary
C

FIFO queue in C: a circular buffer

Implement a fixed-capacity FIFO queue and use `head`, `tail`, and `size` to reuse array slots without shifting elements.

Advanced · ISO C23; implementation support may vary
C

LIFO stack backed by a dynamic array in C

A LIFO stack removes the most recently pushed record first. Keep the element count separate from capacity and grow the buffer without losing data on allocation failure.

Advanced · ISO C23; implementation support may vary
C

Multiplication assignment (`*=`) in C

Use `*=` to multiply the current value and store the result in the same object. The left operand is evaluated once, but you still need a bounds check before doubling a capacity.

Advanced · ISO C23; implementation support may vary
C

Pointer arithmetic in C

Move pointers in element-sized steps, use the one-past position safely, and compute signed differences that fit in `ptrdiff_t`.

Advanced · ISO C23; implementation support may vary
C

Predicate: arrays of predicate callbacks in C

Define `Predicate` as a function pointer type alias, then use an array of callbacks to check whether one order satisfies every rule or at least one rule.

Intermediate · ISO C23; implementation support may vary
C

Self-referential structure in C

A `Group` structure links to subgroups of its own type. A depth-first search checks local values first and can report which group contains the first match.

Advanced · ISO C23; implementation support may vary
C

Tagged union in C

A tagged union pairs an `enum` field with a `union` payload. The tag tells you which alternative was stored and which member to read.

Advanced · ISO C23; implementation support may vary
C

Callbacks in C: function pointers with `typedef`

Name a function pointer type, then use it to pass strategies and predicates, return a selected function, or store callbacks in structs and arrays for later calls.

Intermediate · ISO C23; implementation support may vary
C

Unary minus in C

Unary minus negates an arithmetic operand after integer promotions. If the result type is unsigned, negation uses modular arithmetic. If it is a signed integer type, whether the negated value is representable depends on both the operand’s value and the type’s range.

Advanced · ISO C23; implementation support may vary
C

Integer negation in C: promotions and limits

After any applicable integer promotions, unary minus on a signed integer gives the arithmetic opposite if that value is representable in the promoted type; otherwise the behavior is undefined. For an unsigned promoted type, the result is computed modulo one more than the type’s maximum.

Advanced · ISO C23; implementation support may vary