Interview Questions and Answers :: Broadcom Ltd
Home > Experience Archives > Broadcom Ltd > Interview Question Set 1 > Discussion
8. Write a program to print the Linklist element in reverse order by recursion.
Answer:
void recLinkedList(struct node *head)
{
struct node *tmp = head->next;
if ( tmp != NULL)
recLinkedList(tmp);
printf("\r\n [%d] \r\n", tmp->data);
}
Ambrish
22 Aug, 2016 3:27 PM
void recLinkedList(struct node *head)
{
struct node *tmp = head->next;
if ( tmp != NULL)
recLinkedList(tmp);
printf("\r\n [%d] \r\n", tmp->data);
}
{
struct node *tmp = head->next;
if ( tmp != NULL)
recLinkedList(tmp);
printf("\r\n [%d] \r\n", tmp->data);
}
Report Error
Report Error
Please Login First Click Here