#include <stdio.h>#include <stdlib.h>int main(int argc,char *argv[]){ printf("%s\n",argv[0]);//读取可执行程序(包括路径) /*读取参数*/ int i = 1; while(i < argc) { printf("%s\n",argv[i]); i++; } //说明在dos和unix环境下,用""扩起来的表示其是一个字符串,代表着一个参数 return 0;} 编译器默认只输入一个参数,即 argc=1 argv[0]=.exe文件路径 使用cmd输入多个参数 输入exe文件,参数间用空格隔开 参考 https://www.cnblogs.com/yanglai/p/6927151.html https://blog.csdn.net/dcrmg/article/details/51987413 Author: Michelle19lLink: https://gitee.com/michelle19l/michelle19l/2020/04/13/c语言参数学习/Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally. Donate微信支付寶Previous PostFlask学习教程一——基础Next PostAFL工作过程分析