This is a brief reference of available C constructs.
Conditional execution statements
Different code paths are executed according to the value of given expression
The same code is executed several times
- for executes loop
- while executes loop, checking condition before each iteration
- do-while executes loop, checking condition after each iteration
Continue execution at a different location
- continue skips the remaining part of the enclosing loop body
- break terminates the enclosing loop
- goto continues execution in another location
- return terminates execution of the enclosing function
The same code can be reused at different locations in the program
- function declaration declares a function
- inline specifier hints the compiler to insert a function's body directly into the calling code
- fundamental types defines basic character, integer and floating point types
- pointer types, holding a memory location
- compound types defines types that can hold several data members
- enumeration types defines types that are able to hold only one of the specified values
- union types defines types that can hold data in several representations
- function types define function call signatures, that is the types of arguments and the return type
- cv specifiers specifies constness and volatility of a type
- storage-class specifiers specifies storage duration and linkage of a type
- alignas specifier specifies that the storage for the variable should be aligned by specific amount (since C99)
- function specifiers specifies how the compiler should handle a function (since C99)
Literals are the tokens of a C program that represent constant values, embedded in the source code.
- integer literals are decimal, octal, or hexadecimal numbers of integer type.
- character literals are individual characters of type char, char16_t, char32_t, or wchar_t.
- floating-point literals are values of type float, double, or long double
- string literals are sequences of characters, which may be narrow, multibyte, or wide.
- boolean literals are values of type bool, that is true and false (since C99)
- user-defined literals are constant values of user-specified type (since C99)
An expression is a sequence of operators and operands that specifies a computation. An expression can result in a value and can cause side effects.
- order of evaluation of arguments and subexpressions specifies the order in which intermediate results are obtained.
- operators allow the use of syntax commonly found in mathematics
a = b
a == b
- operator precedence is the order in which operators are bound to their arguments
- alternative representations exist for some of the operators
- typedef declaration creates a synonym for a type
- attributes defines additional information about variable (since C99)
- standard conversions implicit conversions from one type to another