c++ - 求教各位大神关于VS2010与c-free,putchar函数与puts函数的问题
伊谢尔伦
伊谢尔伦 2017-04-17 15:23:22
0
3
730

代码如下

#include<stdio.h>

int main(void)
{
    putchar('\0');
    return 0;
}

求教各位大神,为什么结果会那么奇怪?我私下试过了,为什么putchar('0')会显示a呢?就这一点很奇怪,其他的都正常,请问大神,难道是我的运行库出问题了?本人小白,研究了2天都没想明白,求高人

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
洪涛

It should be a problem with your environment. I tested it on dev c++ and it worked fine

小葫芦

I have no problem in my compiler (gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)). Is the code in your screenshot putchar('0'); or putchar("0") ;?

大家讲道理

putchar outputs a character, puts outputs a string, encounter

The parameter in putchar must use single quotes '0'. If you use double quotes "0", the compiler will randomly output a character

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template