in Programming in C
5,148 views
0 votes
0 votes
#include<stdio.h>
int main()
{
    char c=125;
    c=c+10;
    printf("%d",c);
    return 0;
}

(a) 135 (b) +INF (c) -121 (c) -8

in Programming in C
5.1k views

1 comment

In this by default its Signed char or Unsigned?
0
0

1 Answer

1 vote
1 vote
Best answer
By default its signed so we can get -121 as result

since 125+10 initally 125+2 =127 when 127+1=-128(we move to -ve values) because for char the range is from -128 to +127

So 125+10=-121

if it is unsigned char then we get 125+10=135
selected by

2 Comments

edited by

range :  

signed char 1 byte -128 to 127
Unsigned char 1 byte 0 to 255

ref : http://www.tutorialspoint.com/cprogramming/c_data_types.htm

0
0
I'm sorry u r right I will edit answer
0
0

Related questions