我有以下数据类型声明。
typedef struct{
int aa;
}A;
typedef struct{
int bb;
}B;
typedef struct{
union {
A a;
B b;
}*D;
int other;
}myType;
//Now I want to pass the array "D" and the variable "other" to a function
// that will use them to construct "myType"
// How can I pass D as parameter? what whill be its type?
//I want to have a function like the following with "?" filled.
callFunction(? d, int other){
//construct "myType"
myType typ;
typ.D = d;
typ.other = other;
}
我试图在“mytype”结构之外声明联合,然后使用D* d; 在这种情况下,在“mytype”结构 中我遇到了这个错误
错误:“D”之前的预期说明符限定符列表</p>
代码如下: //上面声明了struct A和B
union {
A a;
B b;
}D;
typedef struct{
D* d;
int other;
}myType;
任何帮助将是可观的,
谢谢。