Why am i getting segmentation fault

help me to solve segmentation fault

plzz help me to solve it

@singh.pankhil40 please share your code using CB IDE

can you tell me how to submit the code ide

@singh.pankhil40 copy paste your code in the IDE
click on the save button
copy the link generated
paste the link here and share it with me


check this one

hi @singh.pankhil40 it is not printing anything when k = 0. otherwise its running fine, not giving segmentation fault.

if i pass head by value in print function it is working fine but if i pass by reference it is giving a segmentation fault

@singh.pankhil40 why are you passing head by reference to the print function? It only needs to read the list not make any changes to it