Hi, i'm now learning both pointers and structs (linked lists) lately, and have an example of a destroy function() for a given linked list. Would somebody mind explaining the processes within the function conceptually to me with as much detail as possible?
Given a node struct:
Code:
typedef struct node Node;
struct node
{
int data;
Node *next;
};
Code:
void destroy(Node *head) //passes entire Node struct? what does *head point to?
{
Node *temp; //Confused on what this does
while(head!=NULL);
{
temp=head;
head=head->next;
free(temp);
}
}
Thanks!