Skip to content
Related Articles

Related Articles

C | Data Types | Question 8
  • Difficulty Level : Medium
  • Last Updated : 27 May, 2019
GeeksforGeeks - Summer Carnival Banner




#include <stdio.h>
int main()
{
    if (sizeof(int) > -1)
        printf("Yes");
    else
        printf("No");
    return 0;
}

(A) Yes
(B) No
(C) Compiler Error
(D) Runtime Error


Answer: (B)

Explanation: In C, when an integer value is compared with an unsigned it, the int is promoted to unsigned. Negative numbers are stored in 2’s complement form and unsigned value of the 2’s complement form is much higher than the sizeof int.

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :