I have two variables of long int
type as shown below:
long int a=-2147483648, b=-2147483648;
a=a+b;
printf("%d",a);
I am getting zero. I tried changing the type to long long int
, but I'm still not getting the correct answer.
This question is related to
c
Use printf("%ld",a);
Have a look at format specifiers for printf
long int n;
scanf("%ld", &n);
printf("%ld", n);
long long int n;
scanf("%lld", &n);
printf("%lld", n);
Hope you've cleared..
Source: Stackoverflow.com