[Solved] What are the Min and Max variable names length from one million variable names in C++? [closed]


The first character in an identifier must be a-z, A-Z, or underscore, for 53 possibilities. Subsequent characters can be digits 0-9 too, for 63 possibilities.
So n characters give 53 * (63**(n-1)) legal identifiers:

Length Names
1      53
2      3339
3      210357    // much less than 1000000
4      13252491  // much more than 1000000

Some of these are reserved words (int, return etc.), which we are not allowed to use. Others begin with an underscore, which the C++ standard frowns on. But these small considerations don’t change the answer, which is 4 (to both your questions).

2

solved What are the Min and Max variable names length from one million variable names in C++? [closed]