fun1() prints the given Linked List in reverse manner. For Linked List 1->2->3->4->5, fun1() prints 5->4->3->2->1.
7
Anónimo
6 mar 2016
This method will give Null pointer exception.
When head=Null then only method returns and execution pointer will come on the line printf("%d ", head->data);
But, at this point head=Null so, code is trying to print null->data which will throw exception.
If the 'if' condition is if(head->next == NULL) return; then linked list will be printed in reverse manner.