You are viewing a single comment's thread. Return to all comments →
void printNthFromLast(struct node* head, int n) { static int i = 0; if (head == NULL) return; printNthFromLast(head->next, n); if (++i == n) printf("%d", head->data); }
Seems like cookies are disabled on this browser, please enable them to open this website
Get Node Value
You are viewing a single comment's thread. Return to all comments →
void printNthFromLast(struct node* head, int n) { static int i = 0; if (head == NULL) return; printNthFromLast(head->next, n); if (++i == n) printf("%d", head->data); }