# c++ %1 help



## winxp rules (Jul 28, 2011)

I know in batch there is %1 is there an equivilent in C++


----------



## JMPC (Jan 15, 2011)

If you're talking about a variable then yes.

Variables. Data Types. - C++ Documentation


----------



## AlbertMC2 (Jul 15, 2010)

Hi

Yes.
The %1 variable in batch programming is used for startup command line arguments.
In c++ you can use a similar function in the main function

```
int main ( int argc, char *argv[] )
```
where argc is the number of arguments and argv[] is an array of arguments. This way when you run your program from the command line you can add arguments to the end of the command line. These arguments would then be assigned to argv[].

For a further explanation and sample programming see: Accepting command line arguments in C++ using argc and argv
and
Command line arguments


----------

