c - 尝试运行 C 程序时不显示输出

标签 c

当我尝试运行该程序时,我的终端不显示任何内容。

这是程序:

/* 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/

相关文章:

c - SQlite C 警告

java - 生成 2^30 的随机数

c - 检测文件 A-Z 和 AA-ZZ 中的字母

c - 如何在 C 中分配 "optind"?

c - 在 linux : differences between canonical and non-canonical methods 中写入 C 中的串行端口

c - 指向数组边界问题的指针

c - 实现多个进程共享的数据结构是否可行?

c - 对于排序数组我应该做什么?

c - 在递归文件遍历 C 期间获取完整文件路径

c - 双指针使用错误