This comment represent a given for a structure object.
/**
* Definition for singly-linked list.
* 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) {}
* };
*/
I can see the member variables are int val.
What is ListNode() : val(0), next(nullptr) {}.
Is this an initialisation list? So after the contrsuctor call with ListNode() the program is then assigning val to 0 with val(0) and initializing the *next pointer with nullptr`?