Segmentation fault!

in my search function , when I search the key element that is present in the linked list, it gives correct output, and when I trying to find the key elements that are not present in the linked list, it gives segmentation fault, Please see my code and help in finding my mistake.

hello @Nikhil-Jettley-2567269533523013

image

here (in line 110) add an extra if condition i.e q!=NULL && q->data!=key

in line 115 , it should be if (q==NULL) return -1

hello @Nikhil-Jettley-2567269533523013
corrected code https://ide.codingblocks.com/s/350584.
Happy Learning !!