what is the need of creating a class
and in void print function
what is the meaning of head->data"->";
Why create a class
Hey @TheSourabh
For a node of linked list
we need two things
- Something to hold data i.e int/char /float or something
- Pointer which will point to next node
Now since we dont have a predefined datatype for this hence we have to create it ourself y using class
now head is a pointer pointing to one object of class node
and head->data is the value that object is holding
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.