This is a code to initialize a 2D array of chars in C
The array is 3X3 of characters
I’m using Eclipse C/C++ IDE for ubuntu
and when using this function GCC outputs an error like this:
subscripted value is neither array nor pointer nor vector
what does tis error means ,can any one help me please , thanks in advance 🙂
void init(char* ptr)
{
int i=0;
int j=0;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
*ptr[i][j]=' ';
}
}
}
Should be defined as
char** ptrthe argument ofinit().