Question

In my code I have:

char DRAW_EX[DRAW_HEIGHT][DRAW_WIDTH] = {
        "*     *",
        " *   * ",
        "   *   ",
        " *   * ",
        "*     *"
           };
char DRAW_CIRCLE[DRAW_HEIGHT][DRAW_WIDTH] = {
        "  ***  ",
        " *   * ",
        "*     *",
        " *   * ",
        "  ***  "
           };
char DRAW_EMPTY[DRAW_HEIGHT][DRAW_WIDTH] = {
        "       ",
        "       ",
        "       ",
        "       ",
        "       "
           };

And the line that gives me the warning is:

char** leftDraw;
leftDraw = board[i][0]==EMPTY?DRAW_EMPTY:(board[i][0]==SHAPE_O?DRAW_CIRCLE:DRAW_EX);

The warning is:

warning: assignment from incompatible pointer type [enabled by default]

What am I doing wrong?

Was it helpful?

Solution

What am I doing wrong?

You are trying to assign a char (*)[DRAW_WIDTH] to a char**. These are incompatible types.

Declare

char (*leftDraw)[DRAW_WIDTH];

and the compiler will be happy with that line.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top