+ 1
Below code gives output as 8. How it is possible?
#include <iostream> using namespace std; int main() { int a=010; cout<<a; return 0; } // Output: 8
6 Answers
+ 3
@Arjun Gowda
The support for 0b was added only after C++03, so if you use an older compiler, 0b may just return an error.
0
what about this?
#include <iostream>
using namespace std;
int main()
{
int a=0b111;
cout<<a;
return 0;
}
//Output 7
0
ok what is the prefix for hexadecimal?