Deleting node in linked list - segmentation fault
问题 Problem requires to delete node from linked list given head pointer of list and the position of node in list to be deleted. More details of question can be found at: https://practice.geeksforgeeks.org/problems/delete-a-node-in-single-linked-list/1 Code returns segmentation fault but not exactly sure where I went wrong. My code is as follows: Node* deleteNode(Node *head,int x) { //Your code here struct Node* temp = head; if(x==0){ //change head head = temp->next; free(temp); } //find previous