[c] Printing long int value in C

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

The answer is


Use printf("%ld",a);

Have a look at format specifiers for printf


To take input " long int " and output " long int " in C is :

long int n;
scanf("%ld", &n);
printf("%ld", n);

To take input " long long int " and output " long long int " in C is :

long long int n;
scanf("%lld", &n);
printf("%lld", n);

Hope you've cleared..