Assuming you mean in C++:
Code:
#include <iostream>
int main(int argc, char*argv[])
{
for(register short int i=0;i<argc;i++)
{
std::cout<<i<<'\t'<<argv[i]<<'\n';
}
return 0;
}
and the input/output:
Code:
jshao@MCP ~/Programming/C++ $ ./test.exe a b c d
0 ./test.exe
1 a
2 b
3 c
4 d
as you can probably see, int argc holds how many command line arguments are sent (seperated by spaces). char*argv[] holds the actual arguments as character arrays
if your program was called on the command line, there's always at least one argument (argc>=1) and the first argument is always the title of the program/way it was invoked (argv[0]="./test.exe").