+ 2
What is argv and argc ???
plz provide a working code with example !!!
3 Réponses
+ 2
argc is the number of argument passed to main function and argv is the array of all arguments passed to the program
+ 1
for example if your main be like this
int main(int argc, char ** argv)
{
for(int j=1; j<argc ;j++)
cout << argv[j] << endl;
return 0;
}
and after compiling your output file be test.exe (in Windows) , if you go to where your .exe file is and type this in CMD:
test.exe hello world
the output will be:
hello
world
0
salam inja kojas 😳