<分区>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#define SIZE 9
typedef struct
{
int row;
int col;
int** arr;
}parameters;
// function prototypes
void* checkRow(void* in);
void* checkCol(void* in);
void* checkSect(void* in);
int main(void)
{
// board to test
int grid[SIZE][SIZE] = {
{6, 5, 3 ,1, 2, 8, 7, 9, 4},
{1, 7, 4, 3, 5, 9, 6, 8, 2},
{9, 2, 8, 4, 6, 7, 5, 3, 1},
{2, 8, 6, 5, 1, 4, 3, 7, 9},
{3, 9, 1, 7, 8, 2, 4, 5, 6},
{5, 4, 7, 6, 9, 3, 2, 1, 8},
{8, 6, 5, 2, 3, 1, 9, 4 ,7},
{4, 1, 2, 9, 7, 5, 8, 6, 3},
{7, 3, 9, 8, 4, 6, 1, 2, 5}
};
printf("Sudoku from Khoa Vo\n");
int i = 0;
int j = 0;
for (i = 0; i < SIZE; i++)
for (j = 0; j < SIZE; j++)
{
printf("%d ", grid[i][j]);
if(j == SIZE)
printf("\n");
}
// paramenter for column and row threads
parameters *data = (parameters*) malloc(sizeof(parameters));
data->row = 0;
data->col = 0;
data->arr = grid;
}
我有一个错误,但我不太清楚如何修复它,语句 data->arr = grid
上有错误,错误消息表明“错误:分配给”int **' 来自不兼容的类型 'int [9][9]。我能得到一些关于如何解决这个错误的建议吗,先谢谢了。