#include<stdio.h>
struct s_{
int b;
}s;
int func1(s** ss){
*ss->a = 10;
}
int func(s* t){
func1(&t);
}
int main(){
s a;
func(&a);
printf("\n a : %d \n",a.b);
return 0;
}
尝试示例程序并获得o/p错误。error'expected')'before'*'token
O/P:
[[email protected]]# gcc d.c
d.c:6: error: expected ‘)’ before ‘*’ token
d.c:9: error: expected ‘)’ before ‘*’ token
d.c: In function ‘main’:
d.c:13: error: expected ‘;’ before ‘a’
d.c:14: error: ‘a’ undeclared (first use in this function)
d.c:14: error: (Each undeclared identifier is reported only once
d.c:14: error: for each function it appears in.)
你忘了''struct'前typedef'关键字? – 2014-09-19 11:39:36
有一个错误,请阅读[运算符优先顺序](http://en.cppreference.com/w/c/language/operator_precedence)。对于另一个错误,名为'a'的结构中没有成员。对于另一个*错误,'s'是一个变量。 – 2014-09-19 11:40:11