Passing variables into c++ using the command line
Go to solution
Solved by Mira Yurizaki,
You pass in arguments like
./a.out 1 2 3 4 5
Arguments are space-separated terms that fill in the argv array. Argc is used to tell you how many arguments there are. Also, important note, the first entry in argv is always the command. In the example above, argv[0] is ./a.out. So you want to make sure you have at least 2 arguments before proceeding.

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now