I keep getting told that in this line of code passing argument from incompatible pointer type.
Here's the line of code:
if (linear_search (size_of_A, argv[i]))
What does this mean and how do I fix it? Here is the whole program:
int linear_search ( int size_of_A, char*argv[]){
int i;
i = 2;
while (i <= size_of_A - 1){
if (!strcmp (argv [1], argv[i])){
return 1;
}
}
return 0;
}
int main (int argc, char*argv []){
int size_of_A = argc - 2;
int i = 2;
if (linear_search (size_of_A, argv)){
printf ("%s not found\n", argv [1]);
return 1;
} else{
printf ("%s found\n", argv[1]);
return 0;
}
i = i + 1;
}
}
Ok, that fixes the warning, but now when I run the program through the compiler nothing happens. It's supposed to tell me if the first argument is repeated or not.
For example the output would look like:
./a 3 hso 8 3
3 found