Explanation of Linked List Declaration format?

  • 0

    Please explain the role of Line Number 4 in the following declaration of Linked List with an example.

    1 struct ListNode {
    2 int val;
    3 ListNode *next;
    4 ListNode(int x) : val(x), next(NULL) {}
    5 };

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.