Data Structure Linked list Question:
Download Questions PDF

Do you know what does the following function do for a given Linked List?

Linked list Interview Question
Linked list Interview Question

Answer:

void fun1(struct node* head)
{
if(head == NULL)
return;

fun1(head->next);
printf("%d ", head->data);
}
fun1() prints the given Linked List in reverse manner. For Linked List 1->2->3->4->5, fun1() prints 5->4->3->2->1.

Download Linked list Interview Questions And Answers PDF

Previous QuestionNext Question
By using C++ with an example describe linked list?Tell me how to find middle element of linked list in one pass?