+ 2

What is argv and argc ???

plz provide a working code with example !!!

9th Jan 2017, 3:51 PM
Siddharth Naithani
Siddharth Naithani - avatar
3 ответов
+ 2
argc is the number of argument passed to main function and argv is the array of all arguments passed to the program
9th Jan 2017, 7:28 PM
Farzin Hooshmand
Farzin Hooshmand - avatar
+ 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
10th Jan 2017, 10:13 AM
Arash Zamani
Arash Zamani - avatar
0
salam inja kojas 😳
11th Jan 2017, 10:46 AM
afsanebanoo