I made a function on how to reverse a singly linked list recursively in C.
the function is as below.
struct node * reverseSLL2(struct node *p,struct node
I'll bet you're running on a machine where the function result is in a register (EAX on 32-bit x86 for example), and the return value from the recursive call is still sitting in that register when you return without a value by falling off the end of the function. The compiler doesn't have to use that sequence, so it's still Undefined Behavior.
You can fix your version by simply adding the return to the recursive call:
return reverseSLL2(temp1,p);