Will Not this Code Work Here in the Place of searching a Node?

This is My code and it is showing me only one result and that is 1. Can you Help me in this?

int nodesearch(node* head,int key){

node* temp = head;
int np = 1;
while(temp->data != key){
    temp = temp->next;
    np++;
}
return np;

}

Please share the link of complete code

paste you code at

click on file->save->link will be generated
send the link of code generated
it will look like https://ide.codingblocks.com/s/258793

I am Sorry, I didn’t Get You

which thing you did not get??

i say to provide link of complete code

1 Like

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.