edited by
557 views

2 Answers

Best answer
17 votes
17 votes

Char is of 1 Byte

range of singed char = {-2^n -1 to +2^n-1} = -128 to +127

char c =125

125+1= 126
125+2= 127
125+3=-128
125+4=-127
125+5=-126
125+6=-125
125+7=-124
125+8=-123
125+9=-122
125+10=-121
selected by
8 votes
8 votes
(125= 01111101) + (10=00001010) = 10000111... showing overflow as addition of two positive numbers giving negative result.
Content of register = 10000111= -121 ( -2^7 + 7)
Answer:

Related questions

0 votes
0 votes
1 answer
1
Bikram asked May 14, 2017
364 views
Spot the error(s) in this code snippet :int n=2; // Line 1 switch(n) { case 1.5: printf( "gate"); break; case 2: printf( "overflow"); break; case 'A': printf("gateoverflo...
0 votes
0 votes
0 answers
2
Bikram asked May 14, 2017
209 views
#include <stdio.h int counter(int i) { static int count = 0; count = count + i; return count; } int main() { int i, j; for (i = 0; i <= 5; i++) j = counter(i); printf ("%...
1 votes
1 votes
1 answer
3
Bikram asked May 14, 2017
311 views
What is the output of the following program?#include <stdio.h int main() { int a = 0; switch(a) { default: a = 4; case 6: a ; case 5: a = a+1; case 1: a = a-1; } printf("...
2 votes
2 votes
1 answer
4
Bikram asked May 14, 2017
206 views
The output of this code snippet is :#include <stdio.h #define x 4+1 int main() { int i; i = x*x*x; printf("%d",i); return 0; }