Click To Get Off-Campus Placement Jobs Info !!!

# C Programming :: Declarations and Initializations - Discussion

Home > C Programming > Declarations and Initializations > MCQs Questions Discussion

7 / 54

What is the output of the following 'C' program?

## #include <stdio.h> void main(){ char c=125; c=c+10; printf("%d",c); }

A135

BINF

C-121

DCompilation Error

Show Explanation

Here char is signed so,the size of char is 1 bytes and its value range are -128 to 127,

and it will be something like below

-128 -127 -126 .......... 0 ....... 126 127 in the cycle.

Now as per questions c = 125 it is under the above limit.

but when 10 added to it, it becomes 125 10 = 135

125 126 127 -128 -127 -126 -125 -124 -123 -122 -121

So, count above 135 will fall at -121, so Answer will be -121

If in the question it would have given unsigned char then answer will be 135

Rate This: +2 -0 +

Rate This: +2 -0 +

Rate This: +0 -0