将要学习c语言了,先记录一下在ubuntu下,使用vim创建一个最基本的hello world程序:
打开终端,使用cd命令转到操作的目录,如我在home下的program files文件内创建,
就是 cd program\ files
接着在终端输入:vim helloworld.c
按下i键,开始编辑代码如下:
#include<stdio.h>
main(){
printf("Hello World!");
}
按esc键,退出编辑模式,再按:wq保存代码。
再在终端输入:gcc helloworld.c -o helloworld
最后,在终端输入:./helloworld
就能运行程序了。