#include <bits/stdc++.h>
using namespace std;
struct ListNode {
    int val;
    ListNode *next;
    ListNode() : val(0), next(nullptr) {}
    ListNode(int x) : val(x), next(nullptr) {}
    ListNode(int x, ListNode *next) : val(x), next(next) {}
};
void printList(ListNode *head) {
    ListNode *curr = head;
    while (curr != NULL) {
        cout << curr->val;
        curr = curr->next;
    }
}
int main() {
    ListNode *head[5];
    ListNode *node;
    head[0] = new ListNode(1,NULL);
    for (int  i = 1; i < 5; i++) {
        head[i] = new ListNode(i + 1, head[i - 1]);
    }
    node = head[5]; //cannot convert 'ListNode*' to 'ListNode**'
    printList(node);
    return 0;
}
How should i pass last node as single pointer to function ? i am not able to convert node in double pointer to single pointer variable.
 
     
    