0 0 votes Consider the following function to traverse a linked list. void traverse(struct Node *head) { while (head->next != NULL) { printf("%d ", head->data); head = head->next; } } Which of the following is FALSE about above function? (A) The function may crash when the linked list is empty (B) The function doesn’t print the last node when the linked list is not empty (C) The function is implemented incorrectly because it changes head Data Structures + – pream sagar 2.8k views answer comment Share Follow Print See all 5 Comments 5 5 Comments reply Shobhit Joshi commented Dec 23, 2018 reply Follow flag all seems correct ? 0 0 replyShare pream sagar commented Dec 23, 2018 reply Follow flag yes i think all option is correct but they given answer as c i did't understand how option c is correct 0 0 replyShare Shobhit Joshi commented Dec 23, 2018 reply Follow flag it can be like, the function is implemented incorrectly because it checks the next node rather than checking if the current node is null, so c can be false. 0 0 replyShare Shaik Masthan commented Dec 23, 2018 reply Follow flag in the given code, head is a local variable but not the global variable. they confused us with same naming. let change the name head as p, then understand the code., then option c as false. 1 1 replyShare Farida Shaikh commented Dec 10, 2019 reply Follow flag Option C is False , as C Language is pass by value here copy of head is passed and not the actual location of head which stores the first address of the node is passed so head value is not getting affected in the above code. Refer the link below to get more clear understanding, https://stackoverflow.com/questions/12124096/what-is-the-difference-between-struct-node-head-and-struct-node-head 0 0 replyShare Please log in or register to add a comment.