ubuntu下编写C程序,如何看输出结果?
黄舟
黄舟 2017-04-21 10:55:21
0
6
466

如题,我在UBUNTU系统下利用记事本编写了一段C程序,程序如下:

main()
{
 char h="Hello World!";
 printf("%c\n",h);
}

利用终端查看,命令如下:
gcc -g -Wall hello.c -o hello.c
结果出现这样的错误:

hello.c:1:1: 警告: 返回类型默认为‘int’ [-Wreturn-type]
hello.c: 在函数‘main’中:
hello.c:3:9: 警告: 初始化将指针赋给整数,未作类型转换 [默认启用]
hello.c:4:2: 警告: 隐式声明函数‘printf’ [-Wimplicit-function-declaration]
hello.c:4:2: 警告: 隐式声明与内建函数‘printf’不兼容 [默认启用]
hello.c:5:1: 警告: 在有返回值的函数中,控制流程到达函数尾 [-Wreturn-type]

这个是什么问题呢?如何才能看到文字输出?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

répondre à tous(6)
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!