Statements 1. and 3. are equivalent, and allocate a block of memory the size of
Statement 2, on the other hand, allocates a block of memory the size of
has been typedef-ed to
struct node *
, so statement 2 could be rewritten as
Node n = malloc(sizeof(struct node *))
This allocates a block for a pointer
, not the size of the thing the pointer points to. For most systems in use today, that will either be 4 or 8 bytes, depending on whether the the system uses 32 or 64 bits natively.