struct sample
{
int a;
char b;
float c;
int *al;
union un
{
int a;
char c;
float f;
}*ptr;
}test;
如何访问结构成员“al”和 union 成员 a,c,f?
最佳答案
与其他人没有区别:
访问
al
test.al
如果你想要
al
的值,可以通过*(test.al)
获取。访问
a
、c
、f
test.ptr->a; test.ptr->c; test.ptr->f;
关于c - 如何访问 C 结构体中的指针成员?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22141541/