I have this code:
void PrintMainParameters(int n, char* array[])
{
int i = 0;
for(i = 0; i < n; i++)
{
printf("%s \n", array[i]);
}
}
int main(int argc, char* argv[] )
{
PrintMainParameters(argc, argv);
}
Works fine. Now I want to write PrintMainParameters as prototype to declare the function later in the source file.
I tried this one, but it says type mismatch, that the second parameter is an incompatible pointer type. I understand the compiler error, but I do not know why it occurs.
void PrintMainParameters(int, char*);
int main(int argc, char* argv[] )
{
PrintMainParameters(argc, argv);
}
void PrintMainParameters(int n, char* array[])
{
int i = 0;
for(i = 0; i < n; i++)
{
printf("%s \n", array[i]);
}
}
How must the prototype look like? Why does my code not work?