You declare it like this:
int main (int argc, char ** argv)
then, your program's name is stored as argv[0].
The first parameter is argv[1], the next argv[2], etc.
argc tells how many parameters are passed, COUNTING the program name. So, if you pass 2 parameters like you want, argc will be 3 (but you should check for this, and print an error message if the user gives too many/too few params). argv[0], argv[1], and argv[2] will be strings (char *'s) to these parameters.
To get an integer numeric input, use the atoi function, like this:
Code:
int main(int argc, char ** argv){
int param1, param2;
//other variables
if (argc < 3){
printf("Too few parameters!");
exit(1);
}
if(argc > 3){
printf("Too many parameters!");
exit(1);
}
//Ok, we have the right # of params:
param1 = atoi(argv[1]);
param2 = atoi(argv[2]);
//Rest of the code here
}