https://ke.qq.com/course/466167?taid=4166582134054135
#include <stdio.h>
/*
* 执行命令 ./hello kodulf
* argc = 2
* argv[0] = ./hello
* argv[1] = kodulf
*
*/
int main(int argc, char **argv){
if(argc >= 2){
printf("hello world %s \n",argv[1]);
} else {
printf("hello world");
}
return 0;
}
执行:这里的-o 是output 的意思
root@iZrj9e3565o1e423gw4xgiZ:/linux_study/lesson_1# gcc -o hello hello.c
root@iZrj9e3565o1e423gw4xgiZ:/linux_study/lesson_1# ls
hello hello.c
root@iZrj9e3565o1e423gw4xgiZ:/linux_study/lesson_1# ./hello kodulf
hello world kodulf
root@iZrj9e3565o1e423gw4xgiZ:/linux_study/lesson_1#
1: 头文件的作用,告诉别人,告诉编译器,这个函数应该怎么调用
2: 头文件在哪里?分为两种情况,
第一在默认路径里面,可以通过一下命令找到默认的,我们一般使用的