printf without arguments is the function pointer, worth a non-zero value (it's built-in so the pointer cannot be zero)
Now you apply logical negation (!) on this non-zero value: you get zero.
Now negate this zero bit-wise (using bit to bit negation ~), you get all 1s in the int bit range (which can vary depending on the compiler)
Printing it in decimal yields -1, and in hexadecimal yields a given number of fs, depending on the size of the integer (on my 32bit integer compiler, I get ffffffff)
(note that -specially the negation of the function pointer- cannot be part of some valid program, this is only for academic purposes)
printf
without arguments is the function pointer, worth a non-zero value (it's built-in so the pointer cannot be zero)Now you apply logical negation (
!
) on this non-zero value: you get zero.Now negate this zero bit-wise (using bit to bit negation
~
), you get all 1s in theint
bit range (which can vary depending on the compiler)Printing it in decimal yields
-1
, and in hexadecimal yields a given number off
s, depending on the size of the integer (on my 32bit integer compiler, I getffffffff
)(note that -specially the negation of the function pointer- cannot be part of some valid program, this is only for academic purposes)