我无法访问结构的成员结构成员语法
的代码如下:
int main()
{
typedef struct tempA
{
int a;
}tempa;
typedef struct tempB
{
tempa **tA;
}tempb;
tempb.(*tA)->a =5;
printf("\n Value of a : %d",tempb.(*tA)->a);
}
我试着用tempb.(*tA)->a;
访问它,但我得到的语法错误:
error: expected identifier before ‘(’ token
什么是访问int a
的正确语法?
在此先感谢
您的代码包含多个错误,包括:缺少main()的参数列表,缺少返回(除非使用C99编译器),更重要的是,没有名为tempb的变量。请发布实际编译的代码,除非问题是“为什么此代码不能编译”。 – DES 2011-03-15 16:56:39
我读得太快了,问题确实是“为什么不能编译” - 但是你仍然试图访问一个不存在的变量。 – DES 2011-03-15 17:03:24