STM32-Keil结构数组问题
请问在STM32-Keil中如何定义结构数组问题。 本帖最后由 ca2000 于 2017-2-10 14:44 编辑typedef struct
{
unsigned char A; //Task ID one by one
}XP;
例如上述结构:使用的时候:
XP.A=100;
编译报错 error:#40: expected an identifier,请问应该如何做?
//定义
typedef struct
{
unsigned char A; //Task ID one by one
}XP;
XPxp;
//调用
xp.A = 40;
struct
{
unsigned char A; //Task ID one by one
}XP;
XP.A=100;
这样也是可以的,去掉typedef ,这会定义匿名结构体,然后定义类型为匿名结构体的数组XP。
typedef是必须要给出结构体名称的!
页:
[1]