20 x 20 array error -> passing arg 1 of from incompatible pointer type

Joined
Mar 9, 2007
Messages
1
Reaction score
0
ok i know this may seem like a novice question, but I am really just totally aggrivated with this program, I wanted to make a 20x20 character array, and i am referring to 400 spots with a single character in each, not 20 strings of length 20. Now i have a global variable char *grid[20][20] which was working before, i get all the other requirements of the program to work then out of nowhere this fails to work anymore.

//"globals.h"
char *grid[20][20];


//main file
..........
........
...........
for(i = 0; i < 20; i++)
{
for(j = 0; j < 20; j++)
{
fscanf(inf, "%s", &grid[j]);
if(strcmp(&grid[j], "S") == 0) //this is where the error occurs
{
Si = i;
Sj = j;
}
if(strcmp(&grid[j], "G") == 0)
{
Gi = i;
Gj = j;
}
}

Is it the way i am declaring this character array, is it actually possible to make a 20 X 20 array with a single character in each slot?
just to let everyone know, i have also declared char grid[20][20] and that just does 20 strings of length 20. please can anyone help me out?!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top