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

fma — C23 mathematical function

`fma(x, y, z)` from `<math.h>` computes `x*y + z` as if product and sum had unlimited precision, then rounds only once to `double`. `fmaf` and `fmal` provide the same operation for the other floating types.

Advanced · C23
C

fmax — C23 mathematical function

`fmax(x, y)` from `<math.h>` returns the greater numeric value of two `double` arguments; `fmaxf` and `fmaxl` serve the other types. Its numeric contract is useful when one argument can be NaN: if exactly one is NaN, the numeric value is returned.

Intermediate · C23
C

fmin — C23 mathematical function

`fmin(x, y)` from `<math.h>` returns the lesser numeric value of two `double` arguments; `fminf` and `fminl` serve the other types. If exactly one argument is NaN, the numeric argument is returned.

Intermediate · C23
C

fmod — C23 mathematical function

`fmod(x, y)` from `<math.h>` returns `x - n*y`, where `n` is `x/y` truncated toward zero; the result magnitude is less than `|y|` and its sign follows `x`.

Intermediate · C23
C

fopen — C23 stream function

`fopen(filename, mode)` from `<stdio.h>` opens the named file, associates it with a new `FILE` stream, and returns its pointer or null on failure. Modes `r`, `w`, and `a`, optional `+` and `b`, and `x` only in the enumerated `w`-based modes select access, creation, truncation, append, and exclusive creation.

Intermediate · C23
C

fprintf — C23 stream function

`fprintf(stream, format, ...)` writes formatted data to the specified stream and returns the number of characters written, or a negative value on an encoding or output failure. Every conversion in `format` must match the actual argument type.

Intermediate · C23
C

fputc — C23 stream function

`fputc(c, stream)` from `<stdio.h>` writes the character corresponding to `c` converted to `unsigned char`. On success it returns that value as `unsigned char` converted to `int`; on failure it returns `EOF` and sets the stream error indicator.

Basic · C23
C

fputs — C23 stream function

`fputs(s, stream)` from `<stdio.h>` writes every character of string `s` before its terminating null byte; it writes neither the terminator nor an automatic newline. It returns a nonnegative value on success or `EOF` on failure.

Basic · C23
C

fread — C23 stream function

`fread(ptr, size, nmemb, stream)` from `<stdio.h>` attempts to read `nmemb` elements of `size` bytes into array `ptr` and returns the number of completely read elements. Data is treated as a sequence of `unsigned char`; a short count means end of file or failure.

Intermediate · C23
C

free — C23 memory function

`free(ptr)` from `<stdlib.h>` deallocates the storage designated by `ptr`, making it available to allocation functions again; a null pointer causes no action and the function returns nothing. A non-null pointer must come from a compatible memory-management function and still designate a live allocation.

Basic · C23
C

freopen — C23 stream function

`freopen(filename, mode, stream)` from `<stdio.h>` closes the file associated with a stream and reassociates the same `FILE` object with the file and mode named by its arguments. It returns `stream` on success or null on failure.

Intermediate · C23
C

frexp — C23 mathematical function

`frexp(value, exp)` from `<math.h>` decomposes a finite value so `value == fraction * 2^*exp`; for a nonzero result, the fraction magnitude lies in `[0.5, 1)`. It returns the fraction and stores the exponent through the valid `exp` pointer.

Intermediate · C23
C

fscanf — C23 stream function

`fscanf(stream, format, ...)` from `<stdio.h>` reads characters from a stream under format directives and stores converted results through successive pointer arguments. It returns the number of assignments performed, or `EOF` when an input failure occurs before the first conversion.

Intermediate · C23
C

fseek — C23 stream function

`fseek(stream, offset, whence)` from `<stdio.h>` sets a stream file position relative to `SEEK_SET`, `SEEK_CUR`, or `SEEK_END`. It returns `0` on success and a nonzero value on failure; success clears the end-of-file indicator and undoes effects of `ungetc`.

Intermediate · C23
C

fsetpos — C23 stream function

`fsetpos(stream, pos)` from `<stdio.h>` restores the file position indicator and the `mbstate_t` object, if any, from a value previously saved by a successful `fgetpos` on a stream associated with the same file. It returns `0` on success and a nonzero value on failure.

Intermediate · C23
C

ftell — C23 stream function

`ftell(stream)` from `<stdio.h>` obtains the current file position indicator. For a binary stream the result counts characters from the beginning of the file; for a text stream it is opaque information that can be passed to `fseek` with `SEEK_SET` to return to the same position.

Intermediate · C23
C

fwrite — C23 stream function

`fwrite(ptr, size, nmemb, stream)` from `<stdio.h>` writes up to `nmemb` objects of `size` bytes from the array designated by `ptr` to a stream. Each object is processed as successive `fputc` calls over its `unsigned char` representation; the function returns the number of complete objects written.

Intermediate · C23
C

getchar — C23 stream function

`getchar()` from `<stdio.h>` obtains the next character from standard input and is equivalent to `getc(stdin)`. It returns the character read as an `unsigned char` converted to `int`, or the `EOF` macro value when end-of-file or a read error occurs.

Basic · C23
C

getenv — C23 environment function

`getenv(name)` from `<stdlib.h>` searches the host environment list for an entry matching the null-terminated `name` string. It returns a pointer to the value string when an entry exists, or a null pointer when the name is not found.

Intermediate · C23
C

gmtime — C23 time function

`gmtime(timer)` from `<time.h>` converts the designated `time_t` calendar-time value to broken-down UTC in a `struct tm` object. It returns a pointer to the result, or null when UTC is unavailable or the value cannot be represented.

Intermediate · C23
C

hypot — C23 mathematical function

`hypot(x, y)` from `<math.h>` returns the nonnegative `sqrt(x*x + y*y)`, but computes it without undue intermediate overflow or underflow. The `hypotf` and `hypotl` variants serve `float` and `long double`, respectively.

Intermediate · C23
C

isalnum — C23 character classification function

`isalnum(c)` from `<ctype.h>` returns a nonzero value when `c` is a letter or a decimal digit in the current locale, equivalently when `isalpha(c) || isdigit(c)` would be true. Otherwise it returns zero; the particular nonzero value need not be 1.

Basic · C23
C

isalpha — C23 character classification function

`isalpha(c)` from `<ctype.h>` returns a nonzero value for an alphabetic character in the current locale. In the `C` locale these are characters accepted by `isupper` or `islower`; another locale can add letters that are not control characters, digits, punctuation, or whitespace.

Basic · C23
C

isblank — C23 character classification function

`isblank(c)` from `<ctype.h>` returns a nonzero value for a standard horizontal spacing character or an additional blank character defined by the current locale. In the `C` locale, space and horizontal tab are true; newline is whitespace but is not blank.

Basic · C23