Long integer overflow in C++

Viewed 3074

Why the below code gives integer overflow warning:

#include <stdio.h>

int main()
{
    long long int x = 100000 * 99999;
    return 0;
}

Whereas below code works perfectly:

#include <stdio.h>

int main()
{
    long long int x = 100000000000000;
    return 0;
}
3 Answers
Related