I have written code to reverse a string in c... it works fine but I can\'t return the reversed string in the main()
function.
#include
You need to modify the string, i.e. the input buffer to reverse()
, instead of just printing it.
Doing this recursively seems a bit obnoxious, but should of course be possible.
Basically, I guess the printing becomes an assignment, something like this: