Skip to content
← Back to Community
how to debug? I'm writing in C
Profile icon
YixunMeng

I'm trying to write a linked list in C. Write now after compiling, there is a segmentation fault and I can't figure out where it is wrong

Voters
Profile icon
LiamoPennimpede
Profile icon
EmilyNishikimot
Profile icon
JamesFujii
Profile icon
ankembhavanabha
Profile icon
lukekach
Profile icon
ZubedaN
Profile icon
AngelineW
Profile icon
surajitdas3
Profile icon
Samouil16
Profile icon
Swethagnanam
Comments
hotnewtop
Profile icon
Highwayman

After each operation, put a unique print statement showing you reach and passed that point if execution. Run the program. Then look for which print statements failed and carefully study the operations you did for those print statements. Maybe print extra things like the size of the list and where it is and all that. If the op uses other functions, Maybe put info to output in those.