+ 3
Why numbers starting from 0 is treated as octal in cpp?
For ex: int a=010; cout<<a; Outputs 8
1 Answer
+ 9
Such prefix are used for integer literals, to signal the intended base for the integer literal. There are some well known integer literal prefix commonly used. Among which are:
0b - Prefix for binary integer literal
0 - Prefix for octal integer literal
0x - Prefix for hexadecimal integer literal
Learn more about integer literals, prefix and suffix here đ
https://www.tutorialspoint.com/cprogramming/c_constants.htm