Sign in to follow this  

Another strange output-printf

This topic is 4250 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

This topic is 4250 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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