The "backspace" escape character '\\b': unexpected behavior?
So I'm finally reading through https://en.wikipedia.org/wiki/The_C_Programming_Language, and I learned something within the first few pages, that there is a backspace escape character, `\\b`.So I go to test it out, and there is some very odd behavior: #include main () { printf("hello worl\\b\\bd\\n"); } The output is "hello wodl". Can anyone explain this?
The backspaces are not erasing previous characters but instead are adjusting the pointer to where the next character prints. So your two backspaces repositions the pointer to where the 'r' was already printed and then overprints it with the 'd'.