I've been studying singly linked lists and crossed with two different typedef struct
implementations.
1st (at CS50 lecture explanation):
// Represents a node:
typedef struct node
{
int number;
struct node *next;
}
node;
2nd (at CS50 short videos explanation):
typedef struct sllist
{
int number;
struct sllist *next;
}
sllnode;
My question is:
In the former implementation, how is the compiler able to differentiate between node
, the alias and node
, the struct
?
Why is it able to differentiate struct
from typedef
, but I cannot use the same variable name for representing int
and string
, for example?