带参数执行

来源:百度知道 编辑:UC知道 时间:2024/05/24 02:03:34
什么是带参数执行

程序+参数运行

如:
hello.c
main (int argc,char **argv)
{
if (argc == 2)
printf("%s\n",argv[1]);
else
printf("hello!");
}

hello 结果输出:hello
hello aa 结果输出:aa

在command下运行程序的时候,(比如你在command下输入:ping 就是在运行ping这个程序)
很多都是可以带参数的. 带参数的意思就是说 从命令行中给出参数,程序接受参数并处理