ProAnswers.org

Is 0 a decimal literal or an octal literal in c++?

Is 0 a decimal literal or an octal literal?

Yes, 0 is an Octal literal in C++.

As per the C++ Standard:

2.14.2 Integer literals [lex.icon]
integer-literal:
decimal-literal integer-suffixopt
octal-literal integer-suffixopt
hexadecimal-literal integer-suffixopt

decimal-literal:
nonzero-digit
decimal-literal digit

octal-literal: 0
octal-literal octal-digit