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;
}
通常编译器会将这个printf
调用优化为puts("Hello, World.")
.
还建议声明main
为int
(use int main() ...
)。
推荐阅读
- javascript - Electron / Nativefier Web App - 新窗口打印问题 [HTML, JS]
- asynchronous - Dart 等待异步函数完成而不等待
- sql - 当我只期望一个值时,DB2 SQL 函数返回多个值
- java - 从 mapbox 复制了一个缺少变量的教程,它不会运行
- firebase - .valueChanges() 和 .get() 有什么区别
- python-3.x - 试图使 Gnome 排序递归
- linux - 如何从结果集中提取字符串或模式
- javascript - 在外部 Javascript 文件中使用传递的变量
- reactjs - 类型错误:state.getIn 不是函数
- python - 使用 plotly.graph_objects.Scatter 绘图时如何使用列作为颜色维度?