C++ examples for Function:main function
Access command line parameters
#include <iostream> using namespace std; int main(int argc, char *argv[]) { int i;//w ww.ja v a2 s.c o m cout << "\nThe number of items on the command line is " << argc << endl << endl; for (i = 0; i < argc; i++) { cout << "The address stored in argv[" << i <<"] is " << int(argv[i]) << endl; // display address as an integer number cout << "The character pointed to is " << *argv[i] << endl; } return 0; }