Multiple choice

What will be the output of the following set of codes after execution?

void main() { int m=32769; unsigned int n=65540; printf(“%d %u”,m,n); }

  1. Garbage value

    • 32767 4
    • 32768 0
    • 32767 3
Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Range of int is -32768 to +32767. Value of m exceeds the limit of int. So after 32767, it goes to the other side of the range and 32769 will convert to -32767. Range of unsigned int is 0 to 65535. Value of n exceeds the limit of int. So after 65535, it goes to the other side of the range and 65535 will convert to 4.