Escape Characters in C String Literals
In string literals, the escape character () is used to represent special characters and prevent ambiguity. The following are the rules governing its use:
Control Characters:
- a: Bell or alert
- b: Backspace
- t: Horizontal tab
- n: Newline
- v: Vertical tab
- f: Form feed
- r: Carriage return
- e: Escape (non-standard GCC extension)
Punctuation Characters:
- ": Quotation mark (not required for '"')
- ': Apostrophe (not required for "'")
- ?: Question mark (used to avoid trigraphs)
- : Backslash
Numeric Character References:
- octal digits (up to 3)
- x hex digits (any number)
- u 4 hex digits (Unicode BMP, C 11)
- U 8 hex digits (Unicode astral planes, C 11)
The escape sequence
The above is the detailed content of How are Escape Characters Used in C String Literals?. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn