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

sqrt — square root

The sqrt function from <math.h> computes the nonnegative square root. It accepts and returns double; an argument less than zero causes a domain error.

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

srand — seed the rand generator

srand seeds the pseudorandom sequence produced by rand. Reusing the same seed repeats the sequence within an implementation.

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

sscanf — read formatted data from a string

sscanf from <stdio.h> reads data from a null-terminated string according to a format. It stores results through pointers and returns the number of successful assignments (excluding `%n`), not the number of characters read.

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

static_assert — compile-time assertion

static_assert checks a condition during compilation rather than program execution. In C23 it is a keyword, not a function; its message is optional.

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

strcat — append a string

strcat from <string.h> appends a source string to a destination string. It requires a sufficiently large buffer and does not check its capacity.

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

strcmp — comparing strings

strcmp compares the contents of two null-terminated strings. Its result describes equality or ordering.

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

strcpy — copying a string

strcpy copies a string including its terminating '\0'. The caller must provide enough destination space and ensure objects do not overlap.

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

strcspn — length of a prefix excluding specified characters

strcspn returns the length of an initial string segment containing none of the characters in a second string. The size_t result is the index of the first match if one exists, or strlen(s1) if there is no match.

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

strdup — dynamically allocated string copy

strdup creates an independent, writable string copy. Check for NULL and release the allocated memory with free.

Basic · C23; ISO C23 does not require a POSIX feature-test macro to expose strdup. The repository's C23 compiler flag alone does not establish production C library support.
C

strerror — describe an error code

strerror converts an error code to a message. The returned text depends on the implementation and locale.

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

strftime — formatting dates and times

strftime from <time.h> formats a struct tm into a buffer. The format controls the date and time representation; reserve space for the terminating null character.

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

strlen — string length

strlen from <string.h> returns a string's length in bytes before the first '\0', excluding that terminator.

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

strncat — append with a source-byte limit

strncat appends at most n source bytes to a string and adds '\0'. The parameter n is not the destination buffer capacity.

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

strncmp — byte-limited comparison

strncmp compares at most n bytes, stopping at '\0'. Equal prefixes do not establish equality of entire strings.

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

strncpy — copying with zero padding

strncpy writes n bytes, padding short input with zeros. It does not guarantee a '\0'-terminated result.

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

strndup — dynamically allocated, length-limited copy

strndup creates an independent string from at most size initial characters of an array, adding a null terminator. Check the result and release it with free.

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

strpbrk — first character from a set

strpbrk finds the first character in a string that belongs to the character set supplied by another string. It returns a pointer to the match or NULL.

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

strrchr — last occurrence of a character

strrchr from <string.h> returns a pointer to the last occurrence of a character in a string, or NULL. The search includes the terminating '\0'.

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

strstr — substring search

strstr from <string.h> finds the first substring and returns a pointer to it, or NULL.

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

strtod — convert a string prefix to double

strtod converts a string prefix to double. endptr lets you detect missing conversions and inspect the remaining text.

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

strtof — convert text to float

strtof reads the beginning of a string as float. The endptr pointer lets you detect missing conversion and remaining text.

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

strtok — splitting a string into tokens

strtok splits a writable string into nonempty tokens, overwriting delimiters and remembering where to continue.

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