Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   20 x 20 array error -> passing arg 1 of from incompatible pointer type (http://www.velocityreviews.com/forums/t482955-20-x-20-array-error-passing-arg-1-of-from-incompatible-pointer-type.html)

DuckMan 03-09-2007 06:34 PM

20 x 20 array error -> passing arg 1 of from incompatible pointer type
 
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[i][j]);
if(strcmp(&grid[i][j], "S") == 0) //this is where the error occurs
{
Si = i;
Sj = j;
}
if(strcmp(&grid[i][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?!


All times are GMT. The time now is 04:56 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.