trouble passing parameter to function
I'm having some difficulty compiling the following code. When I run
Code:
void list_dir (char * dir_name)
{
DIR * d;
d = opendir (dir_name);
.....
}
int main (int argc, char *argv[])
{
list_dir (argv[1]);
return 0;
}
my program compiles without issue, but when I try to pass a second parameter to the function of either argv[2] or *argv, the compiler is telling me too few parameters to function or expecting * when parameter is **, an example is....
Code:
void
list_dir (char * dir_name, char * newz)
{
DIR * d;
d = opendir (dir_name);
.....
}
int main (int argc, char *argv[])
{
list_dir (argv[1], argv[2]);
return 0;
}
Any suggestions on why the compiler doesn't accept how the second argument, argv[2], is being passed. Thanks!