Other operators

A collection of operators that do not fit into any of the other major categories. Operator Operator name Example Description (...) function call f(...) call the function f(), with zero or more arguments , comma operator a, b evaluate expression a, disregard its return value and complete any side-effects, then evaluate expression b, returning the type and the result of this evaluation (type) type cast (type)a cast the type of a to type ? : conditional operator

perror

Defined in header <stdio.h> void perror( const char *s ); Prints to stderr the contents of the null-terminated character string pointed to by s (unless s is a null pointer), followed by the two characters ": ", followed by the implementation-defined error message describing the error code currently stored in the system variable errno (identical to the output of strerror(errno)), followed by '\n'. Parameters s - pointer to a null-terminated string with explanatory me

Objects and alignment

C programs create, destroy, access, and manipulate objects. An object, in C, is region of data storage in the execution environment, the contents of which can represent values (a value is the meaning of the contents of an object, when interpreted as having a specific type). Every object has. size (can be determined with sizeof) alignment requirement (can be determined by alignof) (since C11) storage duration (automatic, static, allocated, thread-local) lifetime (equal to storage duration

Order of evaluation

Order of evaluation of the operands of any C operator, including the order of evaluation of function arguments in a function-call expression, and the order of evaluation of the subexpressions within any expression is unspecified (except where noted below). The compiler will evaluate them in any order, and may choose another order when the same expression is evaluated again. There is no concept of left-to-right or right-to-left evaluation in C, which is not to be confused with left-to-right and

offsetof

Defined in header <stddef.h> #define offsetof(type, member) /*implementation-defined*/ The macro offsetof expands to a constant of type size_t, the value of which is the offset, in bytes, from the beginning of an object of specified type to its specified member, including padding if any. Example #include <stdio.h> #include <stddef.h> struct S { char c; double d; }; int main(void) { printf("the first element is at offset %zu\n", offsetof(stru

Numerics

Mathematical functions Floating-point environment Pseudo-random number generation Complex number arithmetic Type-generic math See also C++ documentation for Numerics library

Null-terminated wide strings

A null-terminated wide string is a sequence of valid wide characters, ending with a null-character. Functions Character classification Defined in header <wctype.h> iswalnum (C95) checks if a wide character is alphanumeric (function) iswalpha (C95) checks if a wide character is alphabetic (function) iswlower (C95) checks if a wide character is an lowercase character (function) iswupper (C95) checks if a wide character is an uppercase character (functi

Numeric limits

Limits of library types Defined in header <stdint.h> PTRDIFF_MIN (C99) minimum value of object of ptrdiff_t type (macro constant) PTRDIFF_MAX (C99) maximum value of object of ptrdiff_t type (macro constant) SIZE_MAX (C99) maximum value of object of size_t type (macro constant) SIG_ATOMIC_MIN (C99) minimum value of object of sig_atomic_t type (macro constant) SIG_ATOMIC_MAX (C99) maximum value of object of sig_atomic_t type (macro constant) Defined in h

Null-terminated multibyte strings

A null-terminated multibyte string (NTMBS), or "multibyte string", is a sequence of nonzero bytes followed by a byte with value zero (the terminating null character). Each character stored in the string may occupy more than one byte. The encoding used to represent characters in a multibyte character string is locale-specific: it may be UTF-8, GB18030, EUC-JP, Shift-JIS, etc. For example, the char array {'\xe4','\xbd','\xa0','\xe5','\xa5','\xbd','\0'} is an NTMBS holding the string "你好" in UTF-8

Null-terminated byte strings

A null-terminated byte string (NTBS) is a sequence of nonzero bytes followed by a byte with value zero (the terminating null character). Each byte in a byte string encodes one character of some character set. For example, the character array {'\x63','\x61','\x74','\0'} is an NTBS holding the string "cat" in ASCII encoding. Functions Character classification Defined in header <ctype.h> isalnum checks if a character is alphanumeric (function) isalpha checks if a charact