argc? argv ?
In main function, there are two parameters, argc and argv. int main( int argc, char **argv) argc := argument count, which is the number of parameters. argv := argument value, which assign by terminal from user. argv[0] := the name of this program argv[1], argv[2] := enter by user
Test:
#include <stdio.h>
​
int main( int argc, char **argv ){
int i = 0;
printf( "argc = %d\n", argc);
for( i=0; i!=argc; ++i){
printf( "argv[%d] = %s\n", i, argv[i] );
}
return 0;
}
​
Copy link