Format Specifier
FORMAT SPECIFIER | TYPE |
%c​ | Character​ |
%d​ | Signed integer​ |
%e or %E​ | Scientific notation of floats​ |
%f​ | Float values​ |
%g or %G​ | Similar as %e or %E​ |
%hi​ | Signed integer (short)​ |
%hu​ | Unsigned Integer (short)​ |
%i​ | Unsigned integer​ |
%l or %ld or %li​ | Long​ |
FORMAT SPECIFIER | TYPE​ |
%Lf​ | Long double​ |
%lu​ | Unsigned int or unsigned long​ |
%lf | Double |
%lli or %lld​ | Long long​ |
%llu​ | Unsigned long long​ |
%o​ | Octal representation​ |
%p​ | Pointer​ |
%s​ | String​ |
%u​ | Unsigned int​ |
%x or %X​ | Hexadecimal representation​ |
%n​ | Prints nothing​ |
%%​ | Prints % character​ |
Escape Sequences
Escape sequence | Meaning |
\a | Alarm or Beep |
\b | Backspace |
\f | Form Feed |
\n | New line |
\r | Carriage Return |
\t | Tab |
\v | Vertical Tab |
\\ | Backslash |
\' | Single Quote |
\" | Double Quote |
\? | Question Mark |
\ooo | Octal number |
\0 | Null |
Operators
1. Arithmetic operator
Operator | Purpose |
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Remainder |
2. Relational operator
Operator | Purpose |
< | Less than |
<= | Less than or equal to |
> | Greater than |
>= | Greater than or equal to |
3. Equality operator
Operator | Purpose |
== | Equal to |
!= | Not equal to |
4. Logical operator
Operator | Purpose |
&& | AND |
|| | OR |
! | NOT |
5. Increment / Decrement operator
Operator | Purpose |
y=++x | Prefix increment |
y=x++ | Postfix increment |
6. Assignment operator
Operator | Purpose |
+= | Add and assign |
-= | Subtract and assign |
*= | Multiply and assign |
/= | Divide and assign |
%= | Takes modulus and assign |
int a=b=c=5 | Multiple assignment |
7. Conditional operator
Operator | Purpose |
? : | result = (marks>=50) ? 'Pass' : 'Fail' |
8. Bitwise operator
Operator | Purpose |
& | Bitwise AND |
| | Bitwise OR |
^ | Bitwise XOR |
~ | Bitwise complement |
<< | Left shift |
>> | Right shift |
9. Special operators
Operator | Purpose |
, | Comma operator |
sizeof( ) | Size of an operator |
No comments
If you have any doubts, Please let me know,