Difference between Long int and Long Long int in CPP or C

I want to know the difference between long int and long long int in C and CPP.
I found many of the competitive programmers using long long instead of long in their codes. I tried exploring the range ( or size) up to which either of them hold.
Here is the code https://github.com/ChitturiSaiSuman/General_Codes/blob/master/size.c
I found both handle same range of Integers.
Can anyone explain the difference between both.

But both were giving same ranges, when I executed the above code.
Here’s the output

If you read the answer on stackoverflow, you’ll know why…

Bro, now long and long long both have memory of 8 bytes. I ran on codechef ide for sizeof(long) and sizeof(long long). Both are giing 8. So, may be because of this they are giving same value. I am not sure

Yeah, that’s what, even I tried printing size of Long Long Int and Long Int using sizeof() in C, both were giving same answer (i.e. 8).

long int is at least 32bit, and long long int is at least 64bit.


If you try it on a 32bit machine, the answer might be different.

Man, today you will mostly find only 64bit machine where int takes 4bytes

Ok, this answer is helpful. Thanks for your concern.