Hey, I'm writting a program in C that is supposed to be a simple connect four game. I ran into problems when I tried to assign my array connects to a set value. The compiler gave me the error, Invalid indirection. Heres a little bit of the code where the problem is.

// ask user how big of a board is wanted
     printf("\n\nSelect game board size.");
     printf("\nEnter number of rows. (min 4, max 9): ");
     scanf("%d", &num_rows);
 
// valid entry check for rows
     while((num_rows < 4) || (num_rows > 9))
     {
       printf("\n\nInvalid entry, Please re-enter row size: ");
       scanf("%d", &num_rows);
     }
     printf("\nEnter number of columns. (min 4, max 9): ");
     scanf("%d", &num_cols);
 
// valid entry check for columns
     while((num_cols < 4) || (num_cols > 9))
     {
       printf("\n\nInvalid entry, Please re-enter row size: ");
       scanf("%d", &num_cols);
     }
 
// memory allocation based on user defined board size
     ptr2d = (char *)malloc(sizeof(char)*num_cols*num_rows);
     board_ptr = ptr2d;

// clean allocated memory and assign a generic filler
     for (j = 0; j <= num_cols; j++)
       for (i = 0; i <= num_rows; i++)
         *board_ptr[i][j] = "*";  //<------problem here

I tried several different ways like:

board_ptr[i][j] ="*"
 *(board_ptr[i][j]) ="*"
 (*board_ptr[i][j]) ="*"

and I'm using Borland C++ builder 5.

This question has already been answered. Start a new discussion instead.