关于main函数的参数

#include <stdio.h>

int main(int argc, char const *argv[])
{
	int i;
	for ( i = 0; i < argc; i++)
	{
		printf("argv[%d] is %s
", i,argv[i]);

	}
	return 0;
}

// int argc;//表示读入字符串个数
// char *argv[];//指针数组,用来存放读入的字符串
// 程序的意思逐个输出所有读入的字符串,每个字符串间空一个制表符间隔

//输入输出样例  在终端环境

// ./a.out -a -k jkj dsad
// argv[0] is ./a.out
// argv[1] is -a
// argv[2] is -k
// argv[3] is jkj
// argv[4] is dsad
原文地址:https://www.cnblogs.com/fazero/p/4608938.html