Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top