C语言中的强制转换

发布时间 2023-06-08 11:34:49作者: 耿通宇

一、数组类型强转为结构体类型

  typedef struct
  {
    uint8_t cmd;
    uint8_t frame;
    uint16_t len;
    uint8_t data[0];
  }beken_ota_pkt;

  

  void ota_send_handler(uint8_t *pbuff, uint16_t len)
  {
    beken_ota_pkt_s* beken_ota_pkt = (beken_ota_pkt_s*)pbuff;

  }