我有一些nesC代码,还有一些结构定义,如下例所示:
typedef nx_struct serial_header {
nx_am_addr_t dest;
nx_am_addr_t src;
nx_uint8_t length;
nx_am_group_t group;
nx_am_id_t type;
} serial_header_t;我不明白为什么他们在第一行写了serial_header,而在最后一行写了serial_header_t。我想知道哪个是这个结构的实际名称,最后一行中添加的_t是什么意思?
发布于 2012-10-01 17:05:19
1)你可以假设serial_header_t等同于nx_struct serial_header,因此你可以像serial_header_t nx1一样在程序中声明这个变量;
注意:您不需要使用nx_struct serial_header。
2)如果你错过了typedef和simple声明,如下所示:
nx_struct serial_header {
nx_am_addr_t dest;
nx_am_addr_t src;
nx_uint8_t length;
nx_am_group_t group;
nx_am_id_t type;
}然后,在源代码中,您应该使用如下所示:
nx_struct serial_header nx1;希望这能有所帮助。
https://stackoverflow.com/questions/12670240
复制相似问题