【发布时间】:2016-02-14 14:07:36
【问题描述】:
下面的代码包含在 STMicroelectronics C 代码中,用于 USB 驱动程序。 我试图了解(理解)它是如何工作的,我承认我的 C 编程并不强。
我的问题是 / 是什么
USBD_Interface_fops_FS =
{ xxxxx }
???
我在 K & R 中找不到,在类似的示例中使用了“=”赋值运算符。
typedef struct _USBD_CDC_Itf
{
int8_t (* Init) (void);
int8_t (* DeInit) (void);
int8_t (* Control) (uint8_t, uint8_t * , uint16_t);
int8_t (* Receive) (uint8_t *, uint32_t *);
}USBD_CDC_ItfTypeDef;
static int8_t CDC_Init_FS (void);
static int8_t CDC_DeInit_FS (void);
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length);
static int8_t CDC_Receive_FS (uint8_t* pbuf, uint32_t *Len);
USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =
{
CDC_Init_FS,
CDC_DeInit_FS,
CDC_Control_FS,
CDC_Receive_FS
};
【问题讨论】:
-
使用 K&R 作为准现代 C 编程的参考,就像尝试使用中古英语词典理解英语一样。你会弄错很多小事,并错过自发布以来的所有更改。
标签: c struct typedef assignment-operator