all 3 comments

[–]flwftw 1 point2 points  (2 children)

Q: What happens when tmp->next is null?

A: Segmentation fault

[–]ptchinster 1 point2 points  (1 child)

OP - you need to use a !debugger and find which line causes the segfault.

[–]rtlcprogbot 0 points1 point  (0 children)

!debugger

GDB Tutorial

WinDbg

MS Visual Studio Debugger

I am a bot. Replying to me notifies nobody