basics of C
operators
| operator | precedence | associativity |
|---|---|---|
| () | 1 high | left to right |
| power | 2 | right to left |
| * / % | 3 | left to right |
| + - | 4 | L - R |
| = | 5 low | R - L |
Associativity
if 2 or more operators have same precedance then the expression will be evaluated by using Associativity
Relational and Logical operators
- "\0", 0, null are False
- 1 is true
- assiciativity left to right
modulus operator (%)
- modulus always gives numerator sign
- mod dosen't work on float values
- if value is small withghout sign it gives same value as output
Scanf()
scanf return int, it return no. of proper inputs given according to format spicifier
Ternary operator
- in ternary operator no. of
? == :otherwise gives error - every colon should match just before Question mark
- every ? followed by : not immediatly but following
good program & bad program
program should work on logic not on compiler increment same variable multiple times in a single line is a bad program