运行环境
操作系统:GUN/Linux CentOS 8.1
编译器:gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4)
代码
在当前目录下递归创建Learnning_record/C_Code/下个day的子目录
[hx@centos8 ~]$ mkdir -p ./Learnning_record/C_Code/day{1,2,3,4,5,6,7}
使用vim在Learnning_record/C_Code/day1/下创建(打开)hello.c文件
[hx@centos8 ~]$ vim ./Learnning_record/C_Code/day1/hello.c
命令行模式下按i键进入插入模式,输入
#include <stdio.h>
int main()
{
printf("Hello,world!
");
return 0;
}
之后按ESC键返回命令行模式,输入:x
保存退出
使用cd切换至./Learnning_record/C_Code/day1/下
[hx@centos8 ~]$ cd ./Learnning_record/C_Code/day1/
ls查看当前目录下所有文件
[hx@centos8 day1]$ ls
hello.c
编译
使用gcc编译器编译hello.c生成可执行文件hello
[hx@centos8 day1]$ gcc hello.c -o hello