Reputation: 18171
Why
printf("%s\n","\061");
prints 1
in output. I expect something like =
Upvotes: 1
Views: 1583
Reputation: 1252
Edited as per @rici's advice (read comment below..)
Because \ddd
is character octal representation. \061
is octal (not decimal) ascii code of '1' and whether you write '\61'
(it's not decimal) or '\061'
is one and same thing.
You should refer to ascii table for clarification ..http://www.asciitable.com/
Upvotes: 2
Reputation: 106052
061
is an octal value having decimal value of 49
. 075
in octal is ASCII value for =
.
Try this to print =
printf("%s\n","\075");
Upvotes: 1
Reputation: 47448
061 octal == 49 decimal == 0x31 hex. That's the ASCII code for the character '1'
Why do you expect '='
?
Upvotes: 5