Variable-length array (VLA) in C
A local buffer declared as `int tmp[n]` gets its length at run time. Validate the bound before declaring it, respect its lifetime, and account for optional automatic VLA support in C23.
CKTIS / C
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
A local buffer declared as `int tmp[n]` gets its length at run time. Validate the bound before declaring it, respect its lifetime, and account for optional automatic VLA support in C23.
Declare function pointers, read the grouping parentheses, and recognize functions that return these pointers.
The unary * operator refers to the object or function designated by a pointer. It does not create an object or allocate memory.
The abort() function from <stdlib.h> initiates abnormal program termination and never returns to its caller.
The abs function from <stdlib.h> returns an int absolute value. Calling abs(INT_MIN) has undefined behavior.
The acos function from <math.h> computes the principal inverse cosine of a double argument. Its result is an angle in radians, not degrees.
The acosh function from <math.h> computes the nonnegative inverse hyperbolic cosine. It takes and returns double; an argument below 1 causes a domain error.
aligned_alloc allocates uninitialized memory with a requested alignment. Check the result for NULL and release the memory with free.
asctime converts struct tm into fixed-format text. In C23, the function is deprecated and should be avoided in new code.
The asin function from <math.h> computes the principal arcsine of a double argument and returns an angle in radians.
asinh from <math.h> computes the inverse hyperbolic sine of a double argument and returns double. Its mathematical domain is all real numbers.
The `assert(...)` macro from `<assert.h>` checks a scalar expression: true does nothing, while false prints diagnostic information and calls `abort()`. It returns no value.
`atan(double x)` from `<math.h>` returns the principal arctangent of its argument in radians in the interval `-π/2` through `π/2`; every real number is in its domain.
`atan2(double y, double x)` from `<math.h>` returns the directional angle of point `(x, y)` from the positive x-axis, in radians in the interval `-π` through `π`. Its arguments are ordered `y` first, then `x`.
`atanh(double x)` from `<math.h>` returns the real principal inverse hyperbolic tangent. For a finite real result, the argument must be in the open interval `(-1, 1)`.
`atexit(void (*func)(void))` from `<stdlib.h>` registers a no-argument function to be called during normal program termination. It returns zero on success and a nonzero value when registration fails.
`atof(const char *nptr)` from `<stdlib.h>` converts the initial portion of a string to `double`; it behaves like `strtod(nptr, NULL)` but provides neither a useful end pointer nor dependable error diagnostics.
`atoi(const char *nptr)` from `<stdlib.h>` converts an initial decimal integer in a string and returns `int`. It skips leading white space, accepts an optional sign, and stops at the first character that does not belong to the number.
`atol(const char *nptr)` from `<stdlib.h>` reads an initial decimal integer and returns `long int`. It skips white space, accepts an optional sign, and stops at the first character outside the number.
`atoll(const char *nptr)` from `<stdlib.h>` converts an initial decimal integer and returns `long long int`. It skips white space, recognizes an optional sign, and ends at the first nonmatching character.
`atomic_compare_exchange_strong(object, expected, desired)` from `<stdatomic.h>` atomically compares atomic `*object` with non-atomic `*expected`. If equal it stores `desired` in the object and returns `true`; otherwise it writes the object’s current value to `*expected` and returns `false`, without spurious failure.
`atomic_compare_exchange_weak(object, expected, desired)` has the same success store and failure update of `*expected` as the `strong` form, but it may return `false` spuriously even when the values compare equal. The read-modify-write on `object` remains atomic; the failure write to `expected` is an ordinary non-atomic write.
`atomic_exchange(object, desired)` from `<stdatomic.h>` performs one atomic read-modify-write operation: it stores `desired` in `*object` and returns the value the object held immediately before the exchange.
`atomic_fetch_add(object, operand)` from `<stdatomic.h>` atomically adds `operand` to an atomic integer or pointer object and returns the value from before the addition. It is one read-modify-write operation.