almost there -- the else and return 0 should not be inside the loop. And move p=p->next; to the bottom of the loop.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Offline 21,950 posts
since Aug 2005