当我尝试运行该程序时,我的终端不显示任何内容。
这是程序:
/* Print a message on the screen*/
#include <stdio.h>
int main()
{
printf("Hello World.\n");
return 0;
}
我做错了什么吗?
--编辑--
我的防病毒软件阻止了程序的执行。
最佳答案
在字符串末尾添加换行符(或使用 puts
):
/* Print out a message on the screen*/
#include <stdio.h>
main()
{
printf("Hello World.\n");
return 0;
}
通常编译器会优化对 puts("Hello, World.")
的 printf
调用。
还建议将 main
声明为 int
(使用 int main() ...
)。
关于c - 尝试运行 C 程序时不显示输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54969890/