Delete node at beginning of linked list c++

PHOTO EMBED

Wed Jun 08 2022 20:12:36 GMT+0000 (Coordinated Universal Time)

Saved by @Ranjan_kumar #c++

struct node
{
    int data;
    node* next;
};
node* head=NULL;

void deleteheadnode()
{
    if(head==NULL)
    cout<<"List Empty";
    else
    {
        node* ptr=head;
        head=head->next;
        free(ptr);
    }
}
content_copyCOPY