Parameters of the main function
argc is short for argument count: the number of arguments passed to main;
argv is short for argument vector: the sequence of (pointers to) arguments passed to main. The first argument argv[0] is always the program name and includes the program’s full path, so strictly speaking the number of arguments we need to supply to main is argc-1;
#include <iostream> using namespace std; void main(int argc,char *argv[]) { for(int i=0;i<argc;i++) { cout<<"argument["<<i<<"] is: "<<argv[i]<<endl; } system("pause"); }
2.