It looks like an expression
long A = 300*300; ^^^^^^^^
computed as int , and an object of type int cannot contain the resulting value.
Write down as follows
long A = ( long )300*300;
or
long A = 300l*300l;
Regarding this initialization
long A = 90000;
then for an integer literal, the compiler defines the integer type that can hold this value.
According to standard C (6.4.4.1 Integer constants)
5 can be represented
And further in the table it is indicated that when the literal has no suffix, the type of the literal is sequentially chosen in the order int , long int , long long int .
int16-bit? 90000 - 24464 = 65536. - VladDintby anintis exactly anint, so if it doesn't fit into anint, the high bytes are discarded. And the constant 90000, as indicated in the answer, is interpreted immediately as along. - VladD