Skip to content
Related Articles

Related Articles

Algorithms Quiz | SP2 Contest 1 | Question 9

View Discussion
Improve Article
Save Article
  • Last Updated : 28 Aug, 2018

What will be the output of the below C program?

#include <stdio.h>
int main()
    if (sizeof(int) > -10)
    return 0;

(B) NO
(D) Compilation Error

Answer: (B)

Explanation: In C, when an integer value is compared with an unsigned int, 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
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!