C Language Study-< escape character > "\a is fantastic!"

Source: Internet
Author: User

C language Escape character
Escape character Significance Aske Horse Value (ASCII) (decimal)
\a Bell Bel 007
\b BACKSPACE (BackSpace), moves the current position to the previous column (delete) 008
\f Page Break (FF), moving the current position to the beginning of the next page 012
\ n Line Break (LF), move the current position to the beginning of the next line 010
\ r Enter (CR) to move the current position to the beginning of the bank 013
\ t Horizontal tab (HT) (jumps to the next tab position) 009
\v Vertical tabulation (VT) 011
\\ Represents a backslash character ' \ ' 092
\‘ Represents a single quotation mark (apostrophe) character 039
\" Represents a double-quote character 034
/ Null character (NULL) 000
\ddd Any character represented by a 1 to 3-bit octal number Three-bit octal
\xhh Any character represented by 1 to 2 hexadecimal digits Two-bit hexadecimal

Now one by one test:

Escape character \a |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

<span style= "color: #33cc00;" > #include <stdio.h> #include <stdlib.h>int main () {    printf ("\a");    return 0;} </span>
Run, you can hear a beep. Personally, this escaped character is the most attractive.

Or you can look like this:

<span style= "color: #33cc00;" > #include <stdio.h> #include <stdlib.h>int main () {    char beep = 7;    printf ("%c", beep);    return 0;} </span>

Or something like this:

<span style= "color: #33cc00;" > #include <stdio.h> #include <stdlib.h>int main () {    char beep = ' \a ';    printf ("%c", beep);    return 0;} </span>

Or something like this:

<span style= "color: #33cc00;" > #include <stdio.h> #include <stdlib.h>int main () {    char beep = ' \007 ';    printf ("%c", beep);    return 0;} </span>

Even this way:

<span style= "color: #33cc00;" > #include <stdio.h> #include <stdlib.h>int main () {    char beep = ' \07 ';    printf ("%c", beep);    return 0;} </span>
this way:

<span style= "color: #33cc00;" > #include <stdio.h> #include <stdlib.h>int main () {    char beep = ' \7 ';    printf ("%c", beep);    return 0;} </span>

() so many! Yes,C language is unpredictable.

The above applet effect is the same.

Escape character \b |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-


Escape Character \f |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-| -|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

#include <stdio.h> #include <stdlib.h>int main () {    char anotherpage = 0xa;/* 0xa = 012, ' \f ' */    int Pa Genum = ten;    printf ("-|-|-|-");    printf ("%c-", anotherpage);    return 0;}

The result of the operation is this:

-|-|-|-
-

How does it work like a newline?

If you choose to directly output this page break phenomenon more wonderful:

#include <stdio.h> #include <stdlib.h>int main () {    printf ("\f");    return 0;}
The phenomenon is so wonderful that it makes people feel the mind. Try one more ~

Escape character \ r |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

#include <stdio.h> #include <stdlib.h>int main () {    printf ("  + B = C\ra");/* There is a space betwee n symbol "and symbol +, when printf receive \ r, A go to the first space!" */    return 0;}

this feels good ~

Escape character \v |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

#include <stdio.h> #include <stdlib.h>int main () {    printf ("\v");    return 0;}
Originally they are a pair of son!!! <\f & \v > ...


escape character \ \ \ \ " |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-| -|-|-|-|-|-|-|-|-|-

I think this is very not pure.

Escape character |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- |-|-|-|-|-|-|-|-|-|-|-

<span style= "color: #3366ff;" > #include <stdio.h> #include <stdlib.h>int main () {    printf ("A");    printf ("n");    printf ("B");    return 0;} </span>


C Language Study-< escape character > "\a is fantastic!"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.