Hi , there was a question asked in one of the interviews.. Delete all the nodes of link list..Let me know if I have written the correct codeHere free just de allocates the memory, so I don't have to define ptr in the loop. Let me know if I am wrong.Code:struct node {int data' struct node *next;}; typedef struct node NODE; NODE head; void deleteall(){ NODE *ptr; ptr=head; while (head!=NULL) {ptr=head; head=head->next; free(ptr); } }