• retagged by
998 views

2 Answers

Best answer
21 21 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 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:
Position:
Show:

Related questions

1 1 vote
1 answers 1 answer
671
671 views
Bikram asked May 14, 2017
671 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("...
3 3 votes
1 answers 1 answer
485
485 views
Bikram asked May 14, 2017
485 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; }
10 10 votes
2 answers 2 answers
879
879 views
Bikram asked May 14, 2017
879 views
What will be the output of this program ?#define square(x) x*x main() { int z; z = 25/square(5); printf("%d",z); }
2 2 votes
1 answers 1 answer
1.1k
1.1k views
Bikram asked May 14, 2017
1,099 views
#include <stdio.h void fun() { int p; static int x=1; p = ++x; printf("%d %d", p, x); if(p <= 2) fun(); printf(“%d %d”, p, x); } int main() { fun(); fun(); }In the above ...