I'm writing a program to count blanks, tabs, and newlines. I remember what the escape sequence for tabs and newlines are, but what about blanks? \b? Or is that backspace?
+2
A:
\b
is backspace (ASCII 0x8). You don't need an escape for regular space (ASCII 0x20). You can just use ' '
.
Matthew Flaschen
2010-07-21 23:37:25
+6
A:
You mean "blanks" like in "a b"
? That's a space: ' '
.
Here's a list of escape sequences for reference.
GMan
2010-07-21 23:37:32
Ah, thanks bud.
MW2000
2010-07-21 23:38:24
A:
Hi,
'\b' is backspace, and you don't really need an escape sequence for blanks as ' ' will do just fine.
Joseph Paterson
2010-07-21 23:37:52
+1
A:
If you want to check if a character is whitespace, you can use the isspace()
function from <ctype.h>
. In the default C locale, it checks for space, tab, form feed, newline, carriage return and vertical tab.
caf
2010-07-21 23:46:04