~ is bit wise complement.
{ Copied from stack overflow: When using a decimal constant without any suffixes the type of the decimal constant is the first that can be represented, in order (the current C standard, 6.4.4 Constants p5):
- int
- long int
- long long int
}
Evaluating first if condition:
-~-1 = -(~(-1))
-1 = 11...1 (32 times in 2’s complement).
~-1 = 00...0 = 0
-0 = 0
Therefore first if condition is: if(0) printf(“COVID”);
Evaluating second if condition:
7 = 0..0111 and 0x000f = 0..01111
~7 =1...1000.
~7 & 0x000f = 0...01000 = 8
Therefore second if condition is: if( 8 == 8) printf(“19”);
Second if condition is true, hence, printf(“19”) gets executed and then printf(“*”) gets executed.
Output: 19*