MC logo
Command Array
[^] CSc 220 Home
[Introduction] [Boolean and Control] [Functions] [Arrays and Pointers] [Dynamic Arrays] [Array Errors] [Command Array] [Standard Containers] [Structs and Classes] [Automatic Pointer] [Multi-File Programs] [Copying Objects] [Templates] [Inheritance] [Plain C I/O] [Type Odds And Ends] [Plain C Strings] [File I/O]
[Command Line Arguments] [Stupid Argument Tricks]
Reading: Pp. 235–239

When a program is run from the command line, the arguments from the command line are presented to main as an array of strings. This array contains the name of the program followed by whatever is typed after it. (Run the first example.)

Note that these are plain C strings, which we have not discussed much, but they convert automatically to C++ strings. This is the easiest way to use them.