How to handle integer overflow in C
Like in the following multiplication program if u give the numbers as 50000 100000 the result is 7502634 which is not correct how do we handle it
#include<stdio.h>
int main()
{
int a,b;
long int result;
printf("enter the numbers to multiply\n");
scanf("%d\n %d", &a, &b);
result = a * b;
if(result > 0){
printf("result is %d\n", result);
return 0;}
else{
printf("result not in range\n");
return -1;
}
}