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

atomic_fetch_and — C23 atomic generic function

`atomic_fetch_and(object, operand)` from `<stdatomic.h>` atomically performs `*object &= operand` on an atomic integer type and returns the value from before the operation. It is one read-modify-write operation.

Advanced · C23
C

atomic_fetch_or — C23 atomic generic function

`atomic_fetch_or(object, operand)` from `<stdatomic.h>` atomically performs `*object |= operand` on an atomic integer type and returns the value from before the bits were set. It is one read-modify-write operation.

Advanced · C23
C

atomic_fetch_sub — C23 atomic generic function

`atomic_fetch_sub(object, operand)` from `<stdatomic.h>` atomically subtracts `operand` from an atomic integer or pointer object and returns the value from before the subtraction. It is one read-modify-write operation.

Advanced · C23
C

atomic_fetch_xor — C23 atomic generic function

`atomic_fetch_xor(object, operand)` from `<stdatomic.h>` atomically performs `*object ^= operand` on an atomic integer type and returns the value from before the bits were toggled. It is one read-modify-write operation.

Advanced · C23
C

atomic_flag_clear — C23 atomic function

`atomic_flag_clear(object)` from `<stdatomic.h>` atomically places the pointed-to `atomic_flag` in the clear state and returns no value. The basic form performs the operation with `memory_order_seq_cst`.

Advanced · C23
C

atomic_flag_test_and_set — C23 atomic function

`atomic_flag_test_and_set(object)` from `<stdatomic.h>` atomically sets an `atomic_flag` and returns its previous state: `false` means the call acquired a previously clear flag, while `true` means it was already set.

Advanced · C23
C

atomic_init — C23 atomic generic function

`atomic_init(obj, value)` from `<stdatomic.h>` initializes the pointed-to atomic object with `value`, including any extra state required by the implementation, and returns no value. If the storage has no declared type, the call gives it the effective atomic type `A`.

Advanced · C23
C

atomic_load — C23 atomic generic function

`atomic_load(object)` atomically returns the value of the pointed-to atomic object. The non-`_explicit` form is equivalent to `atomic_load_explicit(..., memory_order_seq_cst)`; the pointer’s `volatile` qualification preserves device-register semantics.

Advanced · C23
C

atomic_signal_fence — C23 fence function

`atomic_signal_fence(order)` establishes ordering constraints only between thread code and a signal handler executed in that same thread. It has the same order classes as `atomic_thread_fence`, returns no value, and is not a generic function.

Advanced · C23
C

atomic_store — C23 atomic generic function

`atomic_store(object, desired)` atomically replaces the pointed-to object’s value with `desired` and returns no value. The non-`_explicit` form uses `memory_order_seq_cst`; this is a write, not a read-modify-write operation.

Advanced · C23
C

atomic_thread_fence — C23 fence function

`atomic_thread_fence(order)` establishes a memory fence without reading or writing a particular atomic object. Relaxed has no effects; consume/acquire makes an acquire fence, release a release fence, acq_rel both, and seq_cst additionally participates in sequentially consistent ordering. It returns no value.

Advanced · C23
C

at_quick_exit — register functions for quick_exit

at_quick_exit from <stdlib.h> registers a function called by quick_exit. It returns 0 on success and a nonzero value on failure.

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

bsearch — C23 generic search function

`bsearch(key, base, nmemb, size, compar)` searches `nmemb` objects of `size` bytes and returns a pointer to an element matching `key`, or null. The comparator receives the key first and an array element second, returning a negative value, zero, or a positive value.

Intermediate · C23
C

c16rtomb — C23 library function

`c16rtomb(s, c16, ps)` converts a `char16_t` unit encoded as UTF-16 to the current `LC_CTYPE` multibyte representation, stores at most `MB_CUR_MAX` bytes, and returns the number stored including shift sequences.

Advanced · C23
C

c32rtomb — C23 library function

`c32rtomb(s, c32, ps)` converts a `char32_t` unit encoded as UTF-32 to the current `LC_CTYPE` multibyte representation, stores at most `MB_CUR_MAX` bytes, and returns the number stored including shift sequences.

Advanced · C23
C

c8rtomb — C23 library function

`c8rtomb(s, c8, ps)` converts a `char8_t` unit encoded as UTF-8 to the current `LC_CTYPE` multibyte representation, stores at most `MB_CUR_MAX` bytes, and returns the number stored including shift sequences.

Advanced · C23
C

calloc — C23 allocation function

`calloc(nmemb, size)` from `<stdlib.h>` allocates an array of `nmemb` objects of `size` bytes, sets every bit of the allocated region to zero, and returns its pointer or null. C23 also requires null when the product `nmemb * size` would wrap `size_t`.

Intermediate · C23
C

call_once — C23 library function

`call_once(flag, func)` uses a `once_flag` to call `func` exactly once—the first effective call with that flag object—and returns no value. Completion of the effective call synchronizes with every other call using the same flag: callers already in progress and waiting for `func`, as well as later callers.

Advanced · C23
C

cbrt — C23 mathematical function

`cbrt(x)` from `<math.h>` takes a `double` and returns its real cube root; `cbrtf` and `cbrtl` provide the `float` and `long double` forms. A negative argument has a negative real result.

Basic · C23
C

ceil — C23 mathematical function

`ceil(x)` from `<math.h>` returns the smallest integer value not less than `double x`, still represented as `double`; `ceilf` and `ceill` preserve `float` and `long double`. This is rounding toward positive infinity.

Basic · C23
C

clearerr — C23 stream-state function

`clearerr(stream)` from `<stdio.h>` clears both the end-of-file indicator and the error indicator belonging to the specified `FILE` stream; it returns no value. It performs no input or output operation.

Intermediate · C23
C

clock — C23 processor-time function

`clock()` from `<time.h>` returns the best available approximation of processor time actively consumed by the program since an implementation-defined era related to its invocation. The result is `clock_t`; divide by `CLOCKS_PER_SEC` to obtain seconds.

Intermediate · C23
C

cnd_broadcast — C23 condition-variable function

`cnd_broadcast(cond)` from `<threads.h>` unblocks every thread blocked on that condition variable at the time of the call. With no waiters it does nothing; it returns `thrd_success`, or `thrd_error` when the request cannot be honored.

Advanced · C23
C

cnd_destroy — C23 condition-variable function

`cnd_destroy(cond)` releases every resource used by a previously initialized condition variable and returns no value. C23 requires that no thread be blocked waiting on it when the call occurs.

Intermediate · C23