Actually, you probably meant
Code:
int main(argc, char *argv[])
I kind of understand that - argc is an argument count on the command line.
argv[] is where it stores the commands ?....
argv[0] is usually the program's name, that is, the path to the executable. The rest of argv[] is the arguments passed on the command line. argc is the number of items in argv[].
Code:
#include <stdio.h>
int main(int argc, char *argv[]) { /* or **argv */
int x;
printf("argc: %i\n", argc);
for(x = 0; x < argc; x ++) {
printf("argv[%i]: %s\n", x, argv[x]);
}
return 0;
}
Code:
C:\DWK>testargs
argc: 1
argv[0]: C:\DWK\TESTARGS.EXE
C:\DWK>testargs hippo testing
argc: 3
argv[0]: C:\DWK\TESTARGS.EXE
argv[1]: hippo
argv[2]: testing
C:\DWK>testargs "This is a string with spaces in it" hippo
argc: 3
argv[0]: C:\DWK\TESTARGS.EXE
argv[1]: This is a string with spaces in it
argv[2]: hippo
C:\DWK>