Below is a small demonstration on an issue I am having in a much larger program. The error I am getting from gcc is
test.c: In function `main':
test.c:11: warning: passing arg 1 of `test_func' from incompatible pointer type
I have marked line 11 with /* error */
It has been quite a while since I last played around in C and for the life of me an after much searching cannot find what I am doing wrong.
Code:
#include <stdio.h>
#include <string.h>
void test_func( char **t[5] );
int main(void)
{
char *messages[5];
int i;
test_func( &messages ); /* error */
for ( i = 0; i < 5; i++ )
printf( "%s\n", messages[i] );
return 0;
}
void test_func( char **t[5] )
{
int i;
char *m[5] = {
"Testing 1 2 3",
"Another",
"And Again",
"Dont worry almost there",
"Ok done"
};
for ( i = 0; i < 5; i++ )
{
strcpy( *t[i], m[i] );
}
return ;
}