1.what's the error information? Can you copy to here?
2.Do you know this:
after those codes"s1->next=s2->next; s2->next=s1;", you can paint a picture, then you will find out an interesting
thing, "s2->next==s1"-->this will be true, which means before you run those codes, the relationship of s1 and s2
is this "s1->next==s2", right? BUT! after you run those codes the relationship is changed!
Is this you expected? I think the answer is no, because you have set a line to stop the circle like this "while(s2!=NULL)"
if you are not sure the relationship of s1 and s2,(I mean, which one is faster to get the end of the line), how can you set
the stop situation like "s2!=NULL"? right?
--------------------
all in all,"s1->next=s2->next; s2->next=s1;"-->those codes should be wrong in logic.
Please rethink those codes.