Sign in to follow this  
TEUTON

Another strange output-printf

Recommended Posts

Unless that's a typo, that should produce a compiler warning because "\1" isn't a valid escape code.

It works because the printf "%c" in printf tells it to expect a character as an argument, and 141 is the ASCII code for 'a'. I guess the compiler is converting '141' to 141, but I'm not sure why.

Share this post


Link to post
Share on other sites
In a string literal a backslash followed by one to three octal digits (0-7 inclusive) forms an octal escape sequence and specifies the value of a single character in octal notation. The value 141 in octal is 97 in decimal and corresponds to the ascii code for 'a'.

Σnigma

Share this post


Link to post
Share on other sites
Thanks Again... but can't add to anyone's reputation. There are some a**holes here who rate people negative unneccesary.
I tried giving reputation to all but I guess I can't give.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this