微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > MCU和单片机设计讨论 > kile中的结构变量怎么用赋值语句赋值

kile中的结构变量怎么用赋值语句赋值

时间:10-02 整理:3721RD 点击:
UsbMouseDescriptor_bLenth=0x12;前面的UsbMouseDescriptor是变量名后面的blenth是元素我之前用‘.’来连接两者,但是系统报错了
USBCORD.C(14): error C129: missing ';' before '.'
但是我将‘.’去掉或者改成‘_’就没有问题了,我就是不明白c语言里面结构变量赋值不是<结构变量名>.<成员名>吗,那为什么会这样
typedef struct USB
{
   uint8 bLenth;
   uint8 bDescriptorType;
   uint8 bcdUsb[2];
   uint8 bDeviceClass;
   uint8 bDeviceSubClass;
   uint8 bDeviceProtocol;
   uint8 bMaxPackeSize0;
   uint8 idVender[2];
   uint8 idProduct[2];
   uint8 bcdDevice[2];
   uint8 iManufacture;
   uint8 iProduct;
   uint8 iSerialNumber;
   uint8 bNumConfigurations;
   uint8 *StructPosition;
}UsbDeviceDescriptor;
这个是定义结构
UsbDeviceDescriptor UsbMouseDescriptor;
这个就是变量声明。谢谢大写来帮帮忙啦!感激涕零!

.改成->试试

你这个不是结构指针,请用:UsbMouseDescriptor.bLenth而不是下划线,结构指针用->

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top