C Programming Cheatsheet
C Programming Cheatsheet
String Format Specifiers
%[flags][width][.precision][length]specifier
%c
char
%hhd||%hhi
signed char
%hhu
unsigned char
%hhn
signed char*
%lc
wint_t
%ls
wchar_t*
Character Escapes
? \0 - NULL ? \b - backspace ? \f - form feed (new page)
? \n - newline ? \r - carriage return
? \t - tab ? \v - vertical tab
Arithmetic Operators
+
Addition
%s
string
-
Subtraction
%d || %i
signed int
*
Multiplication
%u
unsigned int
/
Division
%hi
short int
%
Modulus/Remainder
%hu
unsigned short int
++
Increment by 1
%hn
short int*
--
Decrement by 1
%l
signed long int
++> Pre-increment and compare
%ln %ll %lln %llu %f || %F %Lf || %Le %e || %E %g || %G %o %x %X %a || %A
long int* signed long long int
long long int* unsigned long long int float or double (%F is uppercase)
long double scientific notation (mantissa/exponent)
shortest representation of %e||%E octal unsigned int
lowercase hex unsigned int uppercase hex unsigned int
hexadecimal float-point
--> Pre-decrement and compare
Equality Operators
==
Equal to
!=
Not equal to
<
Less than
>
Greater than
= Greater than or equal to
Logical Operators
Operand Meaning Example
&&
And (x && y)
||
Or
(x || y)
%ji
intmax_t
!
Not
!(x < y)
%ju
uintmax_t
%jn
intmax_t*
%zi || %zu
size_t || ssize_t
%zn
size_t*
%ti || %tu
ptrdiff_t
%tn
ptrdiff_t*
%p
pointer address
%n
NULL
%%
literal %
Width and Precision
%.3f
float precision of 3 (like 3.141)
%4d
4 digit wide int (like 2015)
%2.2f
2 digits wide and 2 precise (19.95)
Flags
-
Left-justify
+
Right-justify
SPACE
Blank space
#
Preceded hex & octal with "0x" || "0"
0
Left-pad with zeros
Integer from variable - printf("%d", num); Save integer to variable - scanf("%d", &num); Save string to variable - scanf("%s", str_var);
Bitwise Operators
&
AND
|
OR
^ Exclusive OR (XOR)
~ Ones Complement (NOT)
>
Right-shift
Assignment Operators
Operand Meaning Equivalent
=
Assign
None
+=
Add
X = X + Y
-=
Subtract X = X - Y
*=
Multiply X = X * Y
/=
Divide
X = X / Y
%=
Modulus X = X % Y
> Y
&=
AND
X = X & Y
|=
OR
X = X | Y
^=
XOR
X = X ^ Y
Constructs
Do-While Loop i=0; do { printf("%d\n", i); ++i;} while(i ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- if you have to process difficult characters utf 8
- byte encoding chart computer action team
- character sets and unicode in firebird
- moving to c 17 personal experience
- c programming cheatsheet
- utf8 unicode text processing
- unicode characters and utf 8
- the unicode howto
- embedded special characters kiran karidi mahipal vanam
- what is next for lua
Related searches
- c programming language standard
- c programming language specification
- c programming int to string
- c programming books pdf
- c programming book pdf download
- c programming textbook pdf
- c programming for beginners pdf
- c programming string array
- c programming array examples
- c programming linked list
- c programming char array initialization
- c programming character array