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

numeric types — concept C23

Numeric types have implementation-dependent ranges and representations; use `limits.h`, `float.h`, or `stdint.h` types and check overflow before conversion and arithmetic.

Intermediate · C23
C

object model and composition — concept C23

A C object is storage with a type, lifetime, and representation; reading requires a live object and a permitted access type. Structure assignment copies fields, but pointer fields remain shallow references.

Intermediate · C23
C

performance and complexity — concept C23

Performance depends on algorithmic complexity, memory locality, allocation count, and target; preserve correctness first, then measure a representative workload. A micro-optimization based on undefined behavior is a bug.

Intermediate · C23
C

preprocessor and macros — concept C23

The preprocessor handles inclusion, macros, and conditional compilation before C parsing; a macro argument may be expanded more than once. Function-like macros need parentheses, unique internal names, and side-effect-free arguments.

Intermediate · C23
C

Primality testing by trial division

Check whether an integer is prime by testing divisors only up to its square root. In C, the condition `d <= n / d` checks that bound without risking overflow from multiplication.

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

program entry point — concept C23

In a hosted environment execution begins at `int main(void)` or the `argc`/`argv` form; `argc` is nonnegative and `argv[argc]` is a null pointer. Returning from the initial `main` is equivalent to `exit`, and the status is delivered to the environment.

Intermediate · C23
C

records and aggregates — concept C23

`struct` groups named members, `union` shares storage among members, and arrays hold one element type; designated initializers reduce order dependence, but padding and layout must not be assumed without an ABI.

Intermediate · C23
C

recursion — concept C23

Recursion calls a function on a smaller problem until a base case; no progress causes endless calls, and C guarantees neither tail-call elimination nor stack-exhaustion detection.

Intermediate · C23
C

reductions and statistics — concept C23

A reduction folds a sequence into one value; sums and statistics must handle empty input, choose an accumulator that avoids overflow, and account for floating-point rounding error.

Intermediate · C23
C

Round-robin scheduling

Round-robin scheduling gives ready jobs CPU time in turn, for at most one time quantum each. The C example simulates this policy and calculates waiting time and turnaround time under an explicit arrival-ordering rule.

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

scope and lifetime — concept C23

Scope controls name visibility while lifetime controls object existence; a pointer may remain in scope after its object expires, but dereferencing it is undefined.

Intermediate · C23
C

security boundaries — concept C23

A security boundary validates lengths, ranges, encoding, and authorization before using external data; fixed format strings, checked size arithmetic, and ordered cleanup reduce overflows and memory errors.

Intermediate · C23
C

Sliding window for nonnegative values

A sliding window maintains one contiguous array range and moves its boundaries without recomputing every sum. The shrinking variant relies on nonnegative input values.

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

sorting and comparison — concept C23

Sorting requires a consistent ordering relation; a `qsort` comparator returns negative, zero, or positive and should not subtract integers when subtraction may overflow. `qsort` does not guarantee stability.

Intermediate · C23
C

strings and text — concept C23

A C string is a `char` array terminated by the first `\0` byte; length excludes the terminator, but the buffer must reserve space for it. String functions do not know capacity, so a missing terminator or undersized destination causes access outside an object.

Intermediate · C23
C

testing and assertions — concept C23

`assert` checks an invariant in debug builds but `NDEBUG` may remove it; tests must separately cover boundaries, failures, and resources.

Intermediate · C23
C

dates and time — concept C23

C distinguishes calendar `time_t`, processor `clock_t`, and `timespec`; conversions can fail, while time zone, daylight changes, and resolution depend on the environment.

Intermediate · C23
C

type conversion — concept C23

Conversions apply promotions and type changes; narrowing may lose value, out-of-range signed conversion is implementation-defined, and a pointer cast repairs neither alignment nor validity.

Intermediate · C23
C

type system — concept C23

The C type system distinguishes compatible types, qualifiers, and an object’s effective type; incompatible pointer access can violate aliasing, and `const` restricts modification through that lvalue rather than always making storage immutable.

Intermediate · C23
C

undefined and unspecified behavior — concept C23

For undefined behavior the standard imposes no requirements; unspecified behavior chooses an allowed possibility, while implementation-defined behavior must be documented. A test must never depend on an observed UB result.

Intermediate · C23
C

variables — concept C23

A variable is a declared object with a type, scope, and storage duration; an uninitialized automatic variable may hold an indeterminate value whose read can be undefined. Initialize before first read and keep scope narrow.

Intermediate · C23
C

EOF — end-of-file or error sentinel

EOF is a macro from <stdio.h>, used by functions such as fgetc to signal end-of-file or a read error.

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

Integer type limits and widths

Macros from <limits.h> describe an implementation's integer ranges and widths. Use them instead of assuming an 8-bit byte or a 32-bit int.

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