Grammatically speaking, typedef
is actually a storage class, like static
or extern
, and type alias declarations are read like variable declarations. E.g.
int x;
declares x
to be a variable of type int
, while
typedef int x;
declares x
to be a type alias meaning int
.
Similarly,
struct vertexNode {
...
} VertexNode;
would declare VertexNode
to be a struct vertexNode
variable, but adding typedef
makes it an alias for struct vertexNode
. Note that struct vertexNode { ... }
(the whole thing) is a type, just like int
. It first defines struct vertexNode
, and then refers to it.
Additionally, array declarations may appear to behave strangely when you use commas:
int x, y[5];
declares x
to be an int
, while declaring y
to be an array of 5
int
s. (Functions and pointers are also like this.) There are other questions on this site about it.
Putting everything together, your question looks like this if you take away the typedef
:
struct vertexNode
{
VertexType data;
EdgeNodeType *firstEdgeNode;
} VertexNode, AdjList[MAXVEX];
This would declare the type struct vertexNode
, the variable VertexNode
of type struct vertexNode
, and the array AdjList
of MAXVEX
struct vertexNode
s. Adding the typedef
means that VertexNode
becomes an alias for struct vertexNode
and that AdjList
becomes an alias for an array of MAXVEX
struct vertexNode
s. Personally, I wouldn't recommend writing it like this, but I guess it's concise.