can some1 help me with understanding the code
Code:
struct Edge
{
int terminal;
struct Edge *next;
};
struct Edge *Insert_Vertex (int , struct Edge *);
struct Edge * Insert_Vertex (int vertex_no, struct Edge *first) {
struct Edge *new1, *current;
new1 = (struct Edge *) malloc(sizeof(struct Edge));
//current = (struct Edge *) malloc(sizeof(struct Edge));
new1->terminal = vertex_no;
new1->next = NULL;
if (!first)
return (new1);
else {
for(current = first; current->next; current = current->next)
current->next = new1;
return (first);
}
}
I also put how the Linked List is made.
thanks.