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?!
//"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?!