Access command-line arguments by stepping through the array: - C++ Function

C++ examples for Function:main function

Description

Access command-line arguments by stepping through the array:

Demo Code

#include <iostream>
using namespace std;
int main(int argc, char* argv[]) {
   cout << "argc = " << argc << endl;
   for(int i = 0; i < argc; i++)
      cout << "argv[" << i << "] = " << argv[i] << endl;
}

Result


Related Tutorials