Thursday, 2 June 2016

Whether 0(zero) is decimal literal or octal literal in C or C++ programming?

You may studied literal starting with 0 is octal. For Eg 07 will be treated as octal number, on other hand 7 will treated as integer by compiler.

So, now question is whether 0 will be treated as integer or octal by compiler?

It will treated as octal literal by the compiler  not as an integer since rule of thumb is every literal which starts with zero will be considered as octal by the compiler