Output explanation needed (regarding sizeof(int) )

Revision en1, by shank_punk, 2015-07-13 20:24:14

Hi guys. #include <stdio.h> int main() { if (sizeof(int) > -1) printf("True"); else printf("False"); return 0; } This outputs False. If I give any negative value , the output is False. I don't understand why. Shouldn't it be 4>-1 ? If I replace -1 with 0,1,2 or 3, The output is True.

Tags output, c programming, syntax

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English shank_punk 2015-07-13 20:25:04 28
en1 English shank_punk 2015-07-13 20:24:14 403 Initial revision (published)