mal*_*kat 6 c terminal printf character character-encoding
这是我的代码
#include <stdio.h>
int x,y;
int main( void )
{
for ( x = 0; x < 10; x++, printf( "\n" ) )
for ( y = 0; y < 10; y++ )
printf( "%c", 1 );
return 0;
}
Run Code Online (Sandbox Code Playgroud)
它会回归笑脸.我到处搜索笑脸的代码或1的代码但我没有设法找到任何链接或任何解释为什么1的char值返回笑脸,当1的ascii代码是SOH时.我研究了这个问题的答案,但我没有找到解释为什么会发生这种情况的答案.
因为1不是可打印的字符代码。如果你愿意,'1'你需要用字符文字来编写它:
printf( "%c", '1' );
// ^^^
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1487 次 |
| 最近记录: |