code : https://ide.codingblocks.com/s/224563 (linked list traversal and insertion)
Why am i getting segmentation fault? What is it? and How to solve that?
hi @adityakaunhai initially head = NULL, so when you try to access ptr1->next in the push function, it gives segmentation fault because there is no NULL->next.
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.