我想在结构体中嵌入结构体,不知道这样是否可行?请大家帮我看看指导一下
typedef struct Register
{
struct RegisterRequest
{
short UnitLength;
byte UnitType; // 0x01 is for RegisterRequest
short LocalApplyPort;
long double LocalApplyID;
}tRegisterRequest;
struct RegisterReply
{
short UnitLength;
byte UnitType; // 0x02 is for RegisterReply
byte Return; // return 0 if it is successful, return other number if not successful
}tRegisterReply;
}tRegister;
此帖出自
Linux与安卓论坛
typedef struct PlatFormFrame
{
tFrameType FrameType;
}tPlatFormFrame;
typedef struct
{
tRegister pRegister ;
}tFrameType;
typedef struct Register
{
struct RegisterRequest
{
short UnitLength;
byte UnitType; // 0x01 is for RegisterRequest
short LocalApplyPort;
long double LocalApplyID;
}tRegisterRequest;
struct RegisterReply
{
short UnitLength;
byte UnitType; // 0x02 is for RegisterReply
byte Return; // return 0 if it is successful, return other number if not successful
}tRegisterReply;
}tRegister;
这样写有问题吗?被老板骂了个狗血临头
多层嵌套是可行的,但是有没有层数的限制呢
一周热门 更多>