escape sequence and multi character interpretation
Hi
I believe "\" signals that the next character is to be interpreted differently than how it's normally dealt with. Can "\" only be used to signal the alternative interpretation of a signal character at a time? You see, in the code below, the statement in red gives rise to problem. Please help me with it. Thanks.
Re: escape sequence and multi character interpretation
Yes, it's the part in red that causes the problem, but it's not due to an invalid escape sequence. The construct in red is a multicharacter constant and evaluates to an int, and that's wat you get as output: a number. Character literals that are meant to result in a value of type char can only contain a single character (where an escape sequence counts as a single character).
Originally Posted by heights
Can "\" only be used to signal the alternative interpretation of a signal character at a time?
I'm not sure I completely understand your question, but perhaps this is an adequate answer: An escape sequence always consists of a backslash and one other character (where the other character may be a backslash itself) except for those escape sequences specifying a hexadecimal or octal character code.
Re: escape sequence and multi character interpretation
Yes it can only operate on a single character at a time.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
Re: escape sequence and multi character interpretation
there are only 14 escape sequences :
Newline \n
Horizontal tab \t
Vertical tab \v
Backspace \b
Carriage return \r
Formfeed \f
Alert \a
Backslash \\
Question mark \?
Single quotation mark \'
Double quotation mark \"
Octal number \ooo
Hexadecimal number \xhhh
Null character \0
Bookmarks