Output explanation needed (regarding sizeof(int) )

Правка en2, от shank_punk, 2015-07-13 20:25:04

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.

Теги output, c programming, syntax

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский shank_punk 2015-07-13 20:25:04 28
en1 Английский shank_punk 2015-07-13 20:24:14 403 Initial revision (published)