I have executed this program on 32bit Windows 7 OS with Turbo C/C++ editor.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e;
clrscr();
a = 25000;
b = 10000;
c = a + b;
printf(" The value of c = %d\n", c );
d = 5000;
e = c - d;
printf(" The value of e is %d\n", e );
getch();
}
When I print c I get the value -30536, because the value 35000 crosses the max value. But when I use the same c in the expression 'e= c - d;' , I get the correct value as 30000. How is this possible?