转义字符 \a is fantastic !

C语言转义字符

转义字符意义阿斯科马值( ASCII)(十进制)

\v垂直制表(VT)011

现在一一测试:

转义字符 \a|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

<span style="color:#33cc00;">#include <stdio.h>#include <stdlib.h>int main(){printf( "\a" );return 0;}</span>运行,可以听到 嘟 的一声。个人觉得这个转义字符最有魅力了~

或者你可以这样子:

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

或者这样子:

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

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

甚至这样子:

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

<span style="color:#33cc00;">#include <stdio.h>#include <stdlib.h>int main(){char beep = '\7';printf( "%c", beep );return 0;}</span>()这么多种!是啊,,C语言变幻莫测啊。

以上小程序效果都一样。

转义字符\b|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

转义字符\f|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

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

运行结果是这样的:

-|-|-|–

怎么跟换行\n效果一样了?

如果选择直接输出这个走页符现象更奇葩了:

#include <stdio.h>#include <stdlib.h>int main(){printf( "\f" );return 0;}

现象如此奇葩,以至于让人摸不着头脑。再试一个~

转义字符 \r|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

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

这个感觉不错~

转义字符 \v |-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

#include <stdio.h>#include <stdlib.h>int main(){printf( "\v" );return 0;}

原来他们是一对儿!!!<\f & \v > ……

转义字符 \\ \’ &;|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

我觉得这个 极其不单纯。

转义字符 0|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-

人生伟业的建立,不在能知,乃在能行。

转义字符 \a is fantastic !

相关文章:

你感兴趣的文章:

标签云: