Given the following struct
struct foo
{
int b;
int a;
int r;
};
I want to create a new type from this struct, like following
typedef struct foo * foo_t;
That is to say that foo_t is supposed to equal a pointer of struct foo.
So struct foo *var; <=> foo_t var;
Why am I not able to malloc this struct from its type?
foo_t var = malloc(sizeof(*foo_t)); throws an error at the compilation time
error: expected expression before
foo_t
foo_t var = malloc(sizeof((*_foo_t)));