1. unsigned char Index[3];这个是中文的肯定不行
2. struct typFNT_HZ32
{
unsigned char Index[3];
unsigned char Msk[128];
};你这种写法,你必须保证Msk里面有128个字节,因为地址是连续的,你不能在unsigned char Msk[128]又接收16进制,又接受字符串这个是个错
3.struct typFNT_HZ32 codeHZ_32[],应该写成struct typFNT_HZ32 codeHZ_32[2],不写不会报错但应该写
4.正确如下:
#include <stdio.h>
struct typFNT_HZ32
{
unsigned char Index[3];
unsigned char Msk[256];
};
struct typFNT_HZ32 codeHZ_32[2]=
{
{"12",0x08,0x02,0x08,0x02,0x28,0x0A,0x2B,0xEA,0x2A,0xAA,0x2A,0xAA,0x2A,0xAA,0x3F,0xFE,
0x4A,0xAA,0x4A,0xAA,0x4A,0xAA,0xCB,0xEA,0x48,0x0A,0x08,0x02,0x08,0x02,0x00,0x00
},
{"21",0x08,0x02,0x08,0x02,0x28,0x0A,0x2B,0xEA,0x2A,0xAA,0x2A,0xAA,0x2A,0xAA,0x3F,0xFE,
0x4A,0xAA,0x4A,0xAA,0x4A,0xAA,0xCB,0xEA,0x48,0x0A,0x08,0x02,0x08,0x02,0x00,0x00
}
};
int main(void)
{
printf("%s\r\n",codeHZ_32[0].Index);
printf("%x\r\n",codeHZ_32[0].Msk[0]);
printf("%s\r\n",codeHZ_32[1].Index);
printf("%x\r\n",codeHZ_32[1].Msk[0]);
} |