ubuntu下c语言hello world

1.首先用vi编写一个c语言程序文件,命令行输入:vi helloworld.c,建立一个名叫"helloworld.c"的文件

2.在文件中输入内容

#include <stdio.h>

int main()

{

    printf("hello world!");

    return 0;

}

3.命令模式下输入:wq,保存并退出

4.输入gcc helloworld.c,编译默认shengc生成名为a.out的执行文件,可以用gcc -o 编译生成其它名字的执行文件。

5.输入./a.out,执行当前目录的a.out文件,“./”意思是当前目录

原文地址:https://www.cnblogs.com/yuwensong/p/4541188.html