Hello, I am new to C and am in need of some help.

I am getting a warning, assignment makes pointer from integer without a cast.

here is some parts of my code:

struct BOARD
{
   char *theBoard[8][8];
};

typedef struct BOARD Board;

int main(int argc, char *argv[])
{
   Board *newBoard;

   newBoard = loadTable();
}
Board loadTable()
{
   Board table;
   int i;
   int j=0;
   int x;
   int y;
   int b;
   char *in;
   FILE *inFile;
   char line[30];

   inFile = fopen("board1.txt", "r");
   in = fgets(line, 30, inFile);

   while(NULL != in)
   {
      x = 0;

      for(i = 0; (i<strlen(in)) && (x < 8); i++)
      {
         if((in[i] != ' ') && (in[i] != '\n'))
         {

            if(in[i] == 'X')
            {

               table->theBoard[j][x] = ' ';

            }//end if
            else
            {
               table->theBoard[j][x] = in[i];

            }//end else

            x++;

         }//end if
      }//end for

      in = fgets(line, 30, inFile);

      j++;

   }//end while
   fclose(inFile);

   return table;

}//end loadTable

I am trying to load a chess board from a file.
I had the board loaded into an array and printing in my main method, but obviously needed a method to do this. Could someone give me some advice?
Thanks!

Edited 3 Years Ago by Dani: Formatting fixed

Could you please use code tags...and this warning "I am getting a warning, assignment makes pointer from integer without a cast." What line is it on?

it gives the warning when I try to initialize newBoard,
newBoard = loadTable();

it gives the warning when I try to initialize newBoard,
newBoard = loadTable();

Your function - Board loadTable() returns a Board not a pointer to Board

Edited 7 Years Ago by gerard4143: n/a

This article has been dead for over six months. Start a new discussion instead.