Explanation of Linked List Declaration format?

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 };

Comments (0)