Lasīju šeit esošo kodu un man radīja neskaidrības dažas vietas:
Code: Select all
struct AdjListNode
{
int dest;
int weight;
struct AdjListNode* next;
};
//...
struct AdjListNode* newAdjListNode(int dest, int weight)
{
struct AdjListNode* newNode = (struct AdjListNode*) malloc(sizeof(struct AdjListNode));
// šeit nesaprotu- kāpēc ir struct pirms AdjListNode visās vietās?
newNode->dest = dest;
newNode->weight = weight;
newNode->next = NULL;
return newNode;
}