+ 2
[SOLVED] How do I add a line break after printing each char of a string (function argument) in reverse? recursively?
Gretings coders, I made 2 recursive function, first one prints the given argument normally, and the second one prints the given argument in reverse. https://code.sololearn.com/c89Fi4FxjOvj/?ref=app https://code.sololearn.com/c0wRPbtG1Alv/?ref=app I can manage to put a line break after the process is complete for the first one that prints normally, but I can't see how to put a line break for the second one that prints in reverse. Please suggest me a way to get through ... Thanks in advance : ) (Edit) Found a way by using a static variable, shown in second code bit link.
5 Answers
+ 3
What if you write line 29 like this?
puts( "\nDone" );
+ 1
Thank you đ Alex TuÈinean đ
Yes of course I can, but I was looking forward to make the print_reverse() prints it the way print() does : )
+ 1
Mirielle
What did you mean by "the compiler will stop only if the pointer is NULL"? the pointer here points to a valid data - a constant C-string.
Please also explain what danger is present related with if( !*s ), where there is more than one variable.
+ 1
Thanks for stopping by đ Alex TuÈinean đ and Mirielle