2016-03-25 15 views
0

İşaretçiye göstergeyi typedef struct işlevine iletiyorum. Ben typedef struct içeriğini değiştirmek çalıştığınızda, bana aşağıdaki hatayı veriyor:Hata: Bir yapı veya birleşim olmayan bir üyede 'a' isteği

request for member 'a' in something not a structure or union }

kodu:

typedef struct _tempStruct 
{ 
    int a; 
    int b; 
}TempStruct; 

void _function(TempStruct ** param) 
{ 
    TempStruct *temp = *param; 
    temp -> a = 5; //no error 
    *param -> a = 6; //error: request for member 'a' in something not a structure or union 
} 

Here is the link of code on ideone.

Neler eksik?

+3

'(* param) -> a' muhtemelen – Shark

cevap

4

->* (dolaylı yoldan) daha yüksek bir önceliğe sahiptir, böylece

*param -> a = 6; 

-> operatör daha sıkı * göre daha bağlanan

(*param)->a = 6; 
4

ok olmalıdır. Sen gerekir:

(*param)->a = 6; 

-> veya . etrafında boşluk koymayın; çok sıkı bağlanırlar. Uzaylar seni bir neofit olarak işaretler.

İlgili konular