Adjecency List in C


i was trying to build a code in C , an im getting some segmentation fault, plz check and let me knw

https://ide.codingblocks.com/s/209622 plz check this piece of code, im getting segmentation fault, plz help!!!

Refer this for the C implementation. Read the comments

Also you can read this https://www.programiz.com/dsa/graph-adjacency-list

bhaiya i want to address fault in my code,

@akb.tech17
hello Anshul,
a) image
here if head will be null then u will call newNode with same NULL node.
and in newNode u will be accessing NULL->data and and NULL->next which will give u segmentation fault,

Hey @akb.tech17
You have reopened this doubt
How can I help you ?

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.