Hi. I'm writing the code for Exercise 2 from Chapter 1 of K&R's book. I found this problem when i try to show an example of how \b works. To guide you into my way of thinking i'll post the code i've written so far:
I hoped that the second printf statement would print "\b: Backspace." to output and then print the newline character. However, it printed "\b: Backspace.." and then the newline characterCode:#include <stdio.h> main() { printf("\\a: Audible bell.\a\n"); printf("\\b: Backspace..\b\n"); }. I was surprised by this so i decided to put a space between \b and \n. I compiled the corrected program and now it works as i expected it to. Can anyone tell me why the \b\n combination does not work? I'm using gcc v. 3.4.5. Besides, the combination \a\n works since i hear the beep from the speaker and see how the newline character is printed to output.
Thanks.



LinkBack URL
About LinkBacks
. I was surprised by this so i decided to put a space between \b and \n. I compiled the corrected program and now it works as i expected it to. Can anyone tell me why the \b\n combination does not work? I'm using gcc v. 3.4.5. Besides, the combination \a\n works since i hear the beep from the speaker and see how the newline character is printed to output.


