【发布时间】:2014-03-03 08:05:00
【问题描述】:
struct sample
{
int a;
char b;
float c;
int *al;
union un
{
int a;
char c;
float f;
}*ptr;
}test;
如何访问结构成员 'al' 和联合成员 a、c、f?
【问题讨论】:
-
sample.ptr->你的作品?还是 *(sample.al)?
-
我想在分别访问 al 和 a,c,f 时使用 'test' 和 'ptr'。它是如何工作的?
-
test.ptr->a;会起作用。
标签: c pointers member member-pointers