Post what you have put up tilll now and we will definately help you out.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
Pass in another string which will be loaded with the reversed string as you go through your return side of the function
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Leaving aside the 3+ year grave digging...
> char *s="visha";
This MAY be in read-only memory. It certainly is for most modern compilers on most modern operating systems. But since you seem to be using crusty old Turbo C (why I don't know), it will "work for you".
> s[start]=s[last];
Being read-only memory, any attempt to MODIFY said string constant will immediately result in your program being killed off by the OS.
> reverse(s,start+1,last-1);
Your if part returns a result, but this doesn't.
The result will be that the function will return random garbage to the caller (for any non-trivial string). Again, you may be getting lucky. Others who try this code will fare less well.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953