Kwwiker

getNodeByIndex

Mar 26th, 2021
386
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Node* getNode(Node* head, int index) {
  2.     Node* elem = head;
  3.     int i = 0;
  4.     while (i < index && elem != NULL) {
  5.         elem = elem->next;
  6.         i++;
  7.     }
  8.     return elem;
  9. }
  10.  
RAW Paste Data