why did we define the constructor ,what is the use of it here ,we updating values of data members through functions then why do we need it ?
Doubt in the node class
@chitranshanmol07, we are inserting the node into the linked list using functions but we are initializing the node using constructor , if you wound’nt have used constructor, then
you had to to assign values every time you make a new node ,
Node*n = new Node;
n->data=d;
n->next=head;
plus, you had to make sure that if the node is the last node then n->next=NULL;
with constructor you can initialize with values,
its like debating what is correct.
int a=10;
or
int a;
a=10
I hope you understood what i am trying to say
In case of any doubt feel free to ask 
Mark your doubt as RESOLVED if you got the answer
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.