Can someone help me debug this question

public:
    int data;
    node* next;
    
    node(int d){
        int data = d;
        next = NULL;
    }

};

void inserthead(node* &head,int data)

{

node* n = new node(data);
n->next = head;
head = n;
}

void print(node* head){
node* temp = head;
while(temp != NULL){
cout<data<<"–>";
temp = temp->next;
}

}

int main()
{
node* head = NULL;
inserthead(head,5);
inserthead(head,4);
inserthead(head,3);

print(head);

return 0;
}

//-> I am returning all 0’s Somehow

hi @JaveedYara please share your code by saving it on ide.codingblocks.com

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.