Pass in arguments

Passing arguments in C++.

Argument passing.

Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Thursday July 31st, 2008 10:40 PM

#include <iostream>

using namespace std;

int main(int argcchar argv[]) {
    cout << "Argument count is: " << argc << endl << "Location of this program: " << argv[0] << endl;

    return 0;



these two are the same:
// pointer to a pointer
int main(int argc, char ** argv)

// pointer to an character array
int main(int argc, char * argv[])


Download: pass_args.cpp 375 B

Please login or Click Here to register for downloads
Creative Commons License
Pass in arguments by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at
Permissions beyond the scope of this license may be available at