如何Linux环境下编写并输出hello world?

如何Linux环境下编写并输出hello world?

  1. 创建helloworld文件,在控制台输入
touch helloworld.c,
  1. 在helloworld.c文件中编写代码
#include<stdio.h>
int main(void)
{
printf("Hello, world!\n");
return 0;
}
  1. 编译helloworld.c文件,在控制台输入
gcc helloworld.c -o hello
  1. 执行编译的文件hello
./hello
  1. 控制台输出为:hello,world!
    在这里插入图片描述
发布了54 篇原创文章 · 获赞 17 · 访问量 2402

猜你喜欢

转载自blog.csdn.net/qq_44096670/article/details/105731440
今日推荐