结构体有关的简单问题~求高手

来源:百度知道 编辑:UC知道 时间:2024/05/22 06:45:45
想实践一个迷宫算法的,但是编的时候编译器出现了expected constructor, destructor, or type conversion before '.' token的错误~是怎么回事啊?
我写的代码如下~
#include<stdio.h>
#include<stdlib.h>
int dir;
typedef struct
{short int vert;
short int horiz;
}offsets;
offsets move[8];

move[0].vert=-1;move[0].horiz=1;//就在这里停住了!!.改成->也是一样的错误。
...//下面部分就不贴上来了

.....
move[0].vert=-1;move[0].horiz=1;这样的非定义和声明的语句要放到函数里面执行

#include<stdio.h>
#include<stdlib.h>
int dir;
typedef struct
{short int vert;
short int horiz;
}offsets;
offsets move[8];

int main(void)
{
move[0].vert=-1;move[0].horiz=1;
return 0;
}