This is my code for deleting from beginning of a linked list that contains student record.
int delete (struct student **q) {
struct student *current;
current=(struct student *)malloc(sizeof(struct student));
current=head;
head=current->link;
free(current);
//display(current);
return 1;
}
This is the structure
struct student
{
int id;
char name[10];
char gender[10];
struct student * link;
}*head;
But instead of deleting the entire record only the id is changed to 0
before deletion
ID Name Gender
1 Yazhini Female
2 Anu Female
3 Janavi Female
4 Haritha Female
after deletion
ID Name Gender
0 Yazhini Female
2 Anu Female
3 Janavi Female
4 Haritha Female