Jessica Chambers Jessica Chambers - 1 year ago 86
C Question

C - error: request for member ‘---’ in something not a structure or union

This question has been asked before, but from what I have seen it's all people that are misusing

to get pointer values. I AM using
but it is still throwing this error.
Here's my code, it's meant to be a dynamic stack:

Header file:

typedef struct etCel{
element *ele;
struct cel *suiv;
} cel;

typedef cel* pile;

pile init_pile();
int affiche_pile(pile *p);

.c file:

pile init_pile(pile *p){
return NULL;
int affiche_pile(pile *p){
printf("Valeurs de la pile:\n");
return 1;

Answer Source
typedef cel* pile;


int affiche_pile(pile *p){

This leads to believe that p is now a pointer to a pointer. Expand the declarations and you get

cel* *p;

So either you change the function signature to int affiche_pile(pile p) or typedef cel pile

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download