N
natkw1
Hi,
I'm new to C so hopefully someone can give me some guidance on where
I've gone wrong.
I've written the following code, trying to initialize the multi-dim
array but it's not working:
#include <stdio.h>
#include <ctype.h>
#define ROW 2
#define COL 5
void init_array();
main ()
{
char array[ROW][COL];
init_array(array);
return 0;
}
void init_array(char data[][])
{
int r, c;
for (r=0; r<=ROW; r++)
{
for (c=0; c<=COL; c++)
{
data[r][c] = NULL;
}
}
}
But when I try to compile with gcc, I'm getting this message
a2.c: In function `init_array':
a2.c:28: arithmetic on pointer to an incomplete type
Can anyone explain what the error means in english ?
What am I doing wrong ?
Nat
I've tried posting to comp.lang.c.moderated but I must have done
something incorrect as it hasn't been posted yet. My appologies if it
appears twice.
I'm new to C so hopefully someone can give me some guidance on where
I've gone wrong.
I've written the following code, trying to initialize the multi-dim
array but it's not working:
#include <stdio.h>
#include <ctype.h>
#define ROW 2
#define COL 5
void init_array();
main ()
{
char array[ROW][COL];
init_array(array);
return 0;
}
void init_array(char data[][])
{
int r, c;
for (r=0; r<=ROW; r++)
{
for (c=0; c<=COL; c++)
{
data[r][c] = NULL;
}
}
}
But when I try to compile with gcc, I'm getting this message
a2.c: In function `init_array':
a2.c:28: arithmetic on pointer to an incomplete type
Can anyone explain what the error means in english ?
What am I doing wrong ?
Nat
I've tried posting to comp.lang.c.moderated but I must have done
something incorrect as it hasn't been posted yet. My appologies if it
appears twice.