[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppArgc
The argument count equals 1 plus the number of parameters the user gave when starting the executable.
Below is an example showing all parameters a user entered.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppArgc
(C++) argc
With argv the arguments of the main function. argc is an abbreviation for Argument count.The argument count equals 1 plus the number of parameters the user gave when starting the executable.
Below is an example showing all parameters a user entered.
This means if you start the program with e.g.int main(int argc, char* argv[]) { for(int i=0; i<argc; ++i) { std::cout << i << " : " << argv[i] << std::endl; } return 0; }
- include <iostream>
testMain Hello WorldYour output will be something like:
0 : testMain 1 : Hello 2 : World
'argc' links
Code links
- #include
- scope operator, ::
- stream out operator, <<
- char
- cout
- endl
- #include
- iostream
- int
- main
- return
- std
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
