The following code is not working properly. I wanted it to print the sum of 2 billion + 2 billion. Even though I'm using long here, I can't get the answer correct.
#include<stdio.h>
#include<stdlib.h>
int main(void){
long a = 2000000000;
long b = 2000000000;
printf("%li\n",a + b);
return 0;
}
When I run this program I get the value -294967296. I'm using VS Code IDE, Mingw compiler and windows version is windows 11.