[try Beta version]
Not logged in

 
the backspace character

Apr 19, 2014 at 7:18pm
In the following char array, notice the use of a backspace character in a string literal: '\b'.

char text1[50] = "\aHello,\n\tWorld! Mistakee\b was \"Extra 'e'\"!\n";

What exactly does a backspace character do here? When the compiler evaluates this line, does it actually delete the previous character, like when you press the backspace button on the keyboard?
Apr 19, 2014 at 7:49pm
No. The compiler just inserts ASCII code 0x08 into the string, which "represents" a backspace. Terminals may interpret that as moving the caret back one space when writing out the string, but I don't think that is a requirement.
Topic archived. No new replies allowed.