Simple Input question

I'm having a hard time figuring out how to do this:

I've searched around but couldn't seem to find anything. I would like my program to accept input entered at the time it is run. Instead of prompting the user for it later.

So for example, my command line would look somthing like this:

boxcar@laptop: ./program 5 4

instead of:

boxcar@laptop: ./program
enter number: 5
enter number: 4

Any ideas?
any help would be greatly appreciated!

EDIT: really sorry, this should have been posted in the beginners section.
Last edited on
1
2
3
4
5
int main( int argc, char **argv )
{
    // argc is the number of arguments passed to your program (in your example 3 as the 1st argument is the program's name)
   // argv is an array of C strings holding the value (eg: argv[0] = "program name", argv[1] = "5", argv[2] = "4")
}
Thanks so much! It all makes so much more sense now...
Topic archived. No new replies allowed.