Answers for "constructor of a structure in c++"

C++
0

struct constructor in c++

# Definition of a 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) {}
};
Posted by: Guest on December-01-2021

Browse Popular Code Answers by Language