vendredi 28 août 2015

if-else output in C [duplicate]

This question already has an answer here:

What should be the output of the code :

#include <stdio.h>
   main()
   {
       if (sizeof(int) > -1)
           printf("True");
       else
           printf("False");
   }

According to my programming knowledge, sizeof() operator returns the size of datatype. Suppose sizeof(int) returns 4, which is obviously grater then -1 i.e. 4 > -1 . That means condition of "if" is satisfied and it should print "True". But the compiler prints "False".

Can anyone explain ?

Aucun commentaire:

Enregistrer un commentaire