我正在尝试用 C 解决康威的生命游戏。我编写了一个包含所有函数的 .h 文件,但在头文件中收到以下错误:错误:未知类型名称“矩阵”
这是头文件的开头,其中包含我的结构声明和第一个函数:
#include<stdio.h>
#include<string.h>
#define MAX 1000
struct matrix{
int Val, Next;
};
void intro_date(int nr_elem, matrix a[MAX][MAX]){
int x,y;
printf("Enter the line and the column of the element which you wish to read within the matrix: \n");
while(nr_elem){
scanf("%d%d",&x,&y);
a[x][y].Val=1;
--nr_elem;
}
}
Run Code Online (Sandbox Code Playgroud) c ×1