Common escape characters and their meanings
Meaning the escape character ASCII value (decimal) \ a bell (BEL) 007 \ B backspace (BS), the current position to the previous column 008 \ F feed (FF), the current position to the beginning of the next page 012 \ n-line feed (LF), the current position to the beginning of the next row 010 \ R & lt carriage return (CR), the current position to the beginning of the line 013 \ T horizontal tab (the HT) 009 \ V vertical tab (the VT) 011 \ ' single quote 039 \ " bis quotes 034 \\ backslash 092 \ 0 null character (NULL) 000 \ Any character ddd 1 Dao 3-digit octal number represented by three octal \ Xhh 1 Dao 2-digit hexadecimal any character represented by two hexadecimal
All ASCII codes can be represented by "\" plus the number (usually 8 hexadecimal digits). And C is defined in a number preceded by the letters '' to represent the common ASCII characters that can not be displayed, such as \ 0, \ t, \ n and so on, it is called the escape character, because behind the character, it is not original ASCII characters mean. C learning the most common is to use the \ n line break.
/ * Transfer character code implementation * / printf("hello"); printf ( "\ b"); // backspace printf("\n");//换行 printf ( "\ a"); // Bell printf ( "\ t"); // horizontal tab printf ( "\ v"); // vertical tab printf ( "\ '"); // \' represents a single quotation mark printf ( "\" "); // \" represents a single quote
Wrap problems encountered in the case of long codes at the time of writing the code for aesthetics and convenience test code, so the need to involve code, the following discusses several situations:
1, the DEFINE macro #
macro definition is "\ "wraps, such as:
#define MAX(a,b) \ ((a) <(b) ? (b) : (a))
2, line breaks keyword
keyword wrap support: (+ - * /% = , | & ^ ~ || && == =!) And brackets, etc., can a newline.
3. Wrap the string
string wrap Finally, add double quotation marks, the beginning of the next line can also be enclosed in double quotes.
Such as:
char buf[128]; strcpy(buf, "1234567890ab " "cdefg ");
The above-described example is equivalent to:
char buf[128]; strcpy(buf, "1234567890abcdefg ");