Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
argv holds the first index of an array of strings, where argc holds the size of argv. With argc and argv you can access the arguments main is called with from (by the operating system).
One of the two standard forms of main is [1]:
int main() { /* Your code */ } |
argv contains the filename of the program itself at index zero and then the parameters the user gave when starting the executable.
This example shows all parameters a user entered.
#include <iostream> |
This means if you start the program (from command-line) with for example the following line:
TestMain Hello World |
Your output will be something like:
0 : TestMain |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.