我下面的代码给出了奇怪的输出。解释

时间:2016-10-11 08:17:07

标签: c

我无法弄清楚我从下面的代码中获得的输出。

#include <stdio.h>
int main()
{
    printf("\5"); // This gives a different output
    return 0;
}

输出为♣。

1 个答案:

答案 0 :(得分:2)

根据您当前的编码,在反斜杠后有一些特殊字符:

"\5"通常对应于查询(&#34; club&#34;)字符,您可以从here找到该字符。

如果你真的想输出 \ 5 ,你需要放"\\5"