int main()
{
typedef struct
{
u8 KeyCurrentIndex;//当时状况索引号
u8 KeyEnterState;//按下【enter】键时转向的索引号
u8 KeyCancelState;//按下【cancel】键时转向的索引号
u8 KeyUpState;//按下【up】键时转向的索引号
u8 KeyDownState;//按下【down】键时转向的索引号
void (*CurrentOperate)(); //当时状况下履行的功用操作
}KbdTabStruct;
const KbdTabStruct KBD[]=
{
{0,1,2,3,4,(*main)},
{6,7,8,9,10,11},
{0,1,2,3,4,5},
{0,1,2,3,4,5},
};
const KbdTabStruct KBD1=
{
20,27,38,39,40,51,
};
KbdTabStruct *ptr=&KBD[1];//界说指向结构体的指针变量 ptr 并赋初值KBD
KbdTabStruct *pr=&KBD1;//界说指向结构体的指针变量 pr 赋初值KBD1
printf(“%d”,KBD[0].KeyEnterState);//应是1
printf(“%d”,KBD[1].KeyCurrentIndex);//6
printf(“%d”,KBD[1].KeyDownState);//10
printf(“%d”,ptr->KeyDownState);//10
printf(“%d”,(*ptr).KeyDownState);//10
printf(“%d”,(*pr).KeyDownState);//40
}