C Programming Cheatsheet Page 2

ADVERTISEMENT

C Programming Cheatsheet
Datatypes
Literal Constant Prefixes
int_fast16_t
uint_fast16_t
NULL
void
Octal
0
int_fast32_t
uint_fast32_t
_Bool
bool - <stdbool.h>
Binary
0b
int_fast64_t
uint_fast64_t
char16_t - <uchar.h>
char32_t - <uchar.h>
Hexadecimal
0x
intptr_t
uintptr_t
char
double
char
\u
<stdfix.h>
enum
EOF - <stdio.h>
wchar_t string
L
_Fract
_Accum
FILE - <stdio.h>
fpos_t - <stdio.h>
UTF-8 string
u8
_Sat _Fract
_Sat _Accum
float
imaxdiv_t - <inttypes.h>
UTF-16 string
u
<decimal.h>
int
long
UTF-32 string
U
_Decimal32
_Decimal64
long double
long int
Raw literal string R"delimiter(STRING)delimiter"
_Decimal128
_Complex _Decimal32
Storage Classes
Literal Constant Suffixes
long long
long long int
auto - Default specifier; Local-scope
nullptr_t - <stddef.h>
ptrdiff_t - <stddef.h>
unsigned
U || u
extern - Lasts the whole program, block, or
sig_atomic_t - <signal,h>
short
unsigned long long
ULL
compilation unit; globally visible
register - Stored in stack or CPU-register
short char
short int
long
L
during the code block
size_t - <stddef.h>
ssize_t - <stddef.h>
float
F
static - Lasts the whole program, block, or
compilation unit; private in program
struct
union
double
D
typedef - Specifies a new datatype
wctrans_t - <wchar.h>
wctype_t - <wctype.h>
long double
L
_Thread_local - Thread-local-storage; one
instance per thread
wchar_t - <wchar.h>
__ibm128
__float80
W || w
Type Qualifiers
WEOF - <wchar.h>
wint_t - <wchar.h>
__float128
Q || q
const - Value does not change; read-only
restrict - For the lifetime of the pointer, the
signed
unsigned
__ibm128
W
object can only be accessed via the pointer
signed char
unsigned char
_Imaginary
i
volatile - Optimizing-compilers must not
change
signed int
unsigned int
_Complex128
KC
_Atomic - Objects free from data races
signed long
unsigned long
exponent
E
Function Specifiers
signed long int
unsigned long int
__Decimal32
df || DF
inline - Inline the function when compiling
_Noreturn - The function does not return
signed long long
unsigned long long
__Decimal64
dd || DD
Function Attributes (__attribute__(()))
signed long long int
unsigned long long int
__Decimal128
dl || DL
GNU-GCC only
Use in function declaration (header)
signed short
unsigned short
short _Fract || _Sat short _Fract
HR || hr
signed short int
unsigned short int
_Fract || _Sat _Fract
R || r
Attributes.html
__float80
__float128
long _Fract || _Sat long _Fract
lr || LR
Function-Attributes.html
<complex.h>
long long _Fract || _Sat long long
llr || LLR
alias - The function is an alias for another;
_Fract
complex
_Complex
Example: void f () __attribute__
unsigned short _Fract || _Sat unsigned
uhr ||
((weak, alias ("__f")));
float complex
float _Complex
short _Fract
UHR
aligned - Set alignment
double complex
double _Complex
always_inline - Inline the function
unsigned _Fract || _Sat unsigned
ur || UR
_Fract
cold - Unlikely to execute; used for
long double complex
long double _Complex
optimizations
unsigned long _Fract and _Sat
ulr || ULR
imaginary
_Imaginary
constructor - Call function before main()
unsigned long _Fract
destructor - Call function after main()
float imaginary
float _Imaginary
unsigned long long _Fract || _Sat
ullr ||
deprecated - Emit warning msg when called
unsigned long long _Fract
ULLR
double imaginary
double _Imaginary
error - Emit error message when called
flatten - Inline all functions in the function;
short _Accum || _Sat short _Accum
hk || HK
long double imaginary
long double _Imaginary
__attribute__((flatten))
Accum || _Sat _Accum
k || K
_Complex80
_Complex128
hot - Very likely to execute; used for
optimizations
long _Accum || _Sat long _Accum
lk || LK
<stdint.h>
nonnull - None of the input pointers are NULL
long long _Accum || _Sat long long
llk || LLK
intmax_t
uintmax_t
nothrow - The function is guaranteed not to
_Accum
throw an exception
int8_t
uint8_t
unsigned short _Accum || _Sat
uhk ||
optimize - Set specific optimization options for
int16_t
uint16_t
unsigned short _Accum
UHK
the function
pure - The function accepts arguments, has
int32_t
uint32_t
unsigned _Accum || _Sat unsigned
uk || UK
single return, and has no other effects
_Accum
int64_t
uint64_t
returns_twice - Returns two separate values
unsigned long _Accum || _Sat
ulk || ULK
simd - Create multiple functions that can
int_least8_t
uint_least8_t
unsigned long _Accum
process arguments using SIMD instructions
int_least16_t
uint_least16_t
warning - Emit warning message when called
unsigned long long _Accum || _Sat
ullk ||
unsigned long long _Accum
ULLK
int_least32_t
uint_least32_t
int_least64_t
uint_least64_t
int_fast8_t
uint_fast8_t
Created by Devyn Collier Johnson <DevynCJohnson@Gmail.com> (2017) More cheatsheets at DCJTech.info

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 4