Reputation:
I'm writing a function in C (using Eclipse) which has a integer called alpha
, and its assigned value is 077
.
But when I print it out, it prints 63
instead of 77
or 077
.
In fact, it's not just 077
but any integer with a leading 0
is printing an unexpected value. When I remove 0
from 077
, it does print the correct value 77
.
What effect does this leading 0
have?
Upvotes: 2
Views: 131
Reputation: 145919
A number starting with a 0
is an octal number.
077
is 7 x 8 + 7 == 63
Upvotes: 13