OK, I'm using pico on the unix system, and I'm trying to run a program with strings, arrays, functions, and file statements. How do I pass character string arrays to functions? I tried doing it like this, but I keep getting errors.
char botanical[40][n], common[40][n]; /* n defined as 30*/
/skip/
printName(writefile1, id, botanical, common); /* line 50 */
/function/
void printName(FILE *writefile1, int id[], char *botanical[][], char
*common[][])
{
int i;
for(i = 0; i < n; i++)
fprintf(writefile1, "%d%4s%4s\n", id, *botanical, *common); /*
line 80 */
}
/error/
In function 'main':
prog.c:50: warning: passing arg 3 of 'printName' from incompatible
pointer type
prog.c:50: warning: passing arg 4 of 'printName' from incompatible
pointer type
prog.c: In function 'printName':
prog.c:84: arithmetic on pointer to an incomplete type
prog.c:84: arithmetic on pointer to an incomplete type
char botanical[40][n], common[40][n]; /* n defined as 30*/
/skip/
printName(writefile1, id, botanical, common); /* line 50 */
/function/
void printName(FILE *writefile1, int id[], char *botanical[][], char
*common[][])
{
int i;
for(i = 0; i < n; i++)
fprintf(writefile1, "%d%4s%4s\n", id, *botanical, *common); /*
line 80 */
}
/error/
In function 'main':
prog.c:50: warning: passing arg 3 of 'printName' from incompatible
pointer type
prog.c:50: warning: passing arg 4 of 'printName' from incompatible
pointer type
prog.c: In function 'printName':
prog.c:84: arithmetic on pointer to an incomplete type
prog.c:84: arithmetic on pointer to an incomplete type