I was wondering if long long specifies a single datatype then why don't things like int int work? I meant obviously that's not a data type but there is a long data type. Essentially what I'm asking is:

int a = 0; //okay
long b = 0; //still fine
long long c = 0; //really long number but its okay....
int int d = 0; //error


  • 1
    That's because the language standard says so.
    – gnasher729
    May 5, 2016 at 7:59

2 Answers 2


The difference between long long and int int is that long modifies a type, rather than being a type itself. long is really a shorthand for long int and long long a shorthand for long long int.

More specifically int is a type specifier, just like char or bool. long is a type modifier. Other type modifiers are unsigned and signed and short.

If one of the modifiers is missing then the type will fall back to a default. E.g. if there is no signed or unsigned then the type will be signed. If there is no short or long the default size depends on the compiler and the architecture.

Take a look at this table on Wikipedia for a full list of how different type specifiers and modifiers can be combined.


In current versions of the C and C++ standards long and short are actually type specifiers in their own right. This doesn't change the way that things can be combined though.

  • Note that originally, C defaulted types to int in many circumstances if they weren't specified. That "long" is shorthand for "long int" is a special case of that. There's also "short" -> "short int", "unsigned" -> "unsigned int" and the fact that in original C (before ANSI standardisation) function parameter and return types could be omitted and would default to int, too.
    – Jules
    May 5, 2016 at 9:00
  • 4
    Technically, your notion about long being a modifier and int a specifier is not correct. Both are listed as type specifiers in modern C and C++ standards; there is no such thing as type modifiers. The standards also list all possible combinations of type specifiers, including long long, long long int, signed long long, signed long long int (all four synonymous), but not int int.
    – ach
    May 5, 2016 at 12:27
  • Yep, you're right. I didn't know that. Looks like I'm harking back to the old days of C. long and int are both instances of a simple-type-specifier in the current C++ grammar.
    – Will
    May 6, 2016 at 6:37

You can specify a long integer that is longer than a long as long long.

But what would it mean to specify an integer that is more integer than int?

More precisely. In C++ you have type int, which is normally a 32-bit wide integer. You then have the modifiers short and long that can be used as illustrated by the following example:

#include <iostream>

using namespace std;

int main(int argc, char *argv[])
    cout << "short int:     " << sizeof(short int) << endl;
    cout << "short:         " << sizeof(short) << endl;
    cout << "int:           " << sizeof(int) << endl;
    cout << "long int:      " << sizeof(long int) << endl;
    cout << "long:          " << sizeof(long) << endl;
    cout << "long long int: " << sizeof(long long int) << endl;
    cout << "long long:     " << sizeof(long long) << endl;

On my Linux box, running g++ 4.7.2, this gives:

short int:     2
short:         2
int:           4
long int:      8
long:          8
long long int: 8
long long:     8


  • int is a 32-bit signed integer
  • short int (abbreviated, short) is a 16-bit signed integer
  • long int (abbreviated, long) is a 64-bit signed integer
  • long long int (abbreviated, long long) is still a 64-bit signed integer on my architecture / compiler, but it is in the language to allow a longer integer type (e.g. 128 bit) on different architectures / compilers.

So, as Will has explained: in this context, long is a modifier that can be applied twice whereas int is not a modifier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.