#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