How to pass Arguments to Main?

My main in a program looks like:

int main(int argc, char* argv[]){...}

I want to use Linux to compile my program, but I don't know how to pass arguments in for argc and argv. How do I do that?

when you run your program from the command line:

OR if you are using an IDE in linux there must be an option somewhere to specify your arguments when you run your code.
Are you using an ide? If so which one?
These arguments are passed in at run time, not at compile time. You simply pass a space separated list of arguments after you program name at the command line (terminal, prompt, etc.) argc will equal the number of arguments passed in plus one, and argv will hold all these arguments' values, the first being argv[1]. (argv[0] holds the program name.)
Topic archived. No new replies allowed.