Display command-line arguments - C++ Function

C++ examples for Function:main function

Description

Display command-line arguments

Demo Code

#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
   int i;/* www. j  a v  a 2  s. com*/
   cout << "\nThe following arguments were passed to main(): ";
   for (i = 0; i < argc; i++)
      cout << argv[i] << " ";
   cout << endl;
   return 0;
}

Result


Related Tutorials