#include <stdio.h>
#include <stdlib.h>
typedef int element;
struct cell {
element e;
struct cell *p;
};
typedef struct cell* CELL;
int main() {
CELL* p;
p = (CELL*) malloc (sizeof(struct cell));
p->e = 8; /* This ain't working */
*p.e = 8; /* This doesn't help anything either */
return 0;
}
I'm just getting started with malloc
and I just made a pointer to a newly created CELL
, which is a struct
. Now I'm trying to fill it with some values, but I'm greeted by an unfriendly "request for member e" in something not a structure or union". I did make a pointer to a struct
that contains a member called e, or at least that's what I think I did. Why does this fail?