+ 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.

10th Jan 2023, 10:30 AM
Ipang
4 ответов
+ 3
What if you write line 29 like this? puts( "\nDone" );
10th Jan 2023, 11:45 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 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 : )
10th Jan 2023, 4:39 PM
Ipang
+ 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.
10th Jan 2023, 4:49 PM
Ipang
+ 1
Thanks for stopping by 🍇 Alex Tușinean 💜 and Mirielle
10th Jan 2023, 7:07 PM
Ipang