fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void tnirp(const char* str)
  5. {
  6. if(*str)
  7. {
  8. tnirp(str+1);
  9. cout << *str;
  10. }
  11. }
  12.  
  13.  
  14. void print(const char* str)
  15. {
  16. if(*str)
  17. {
  18. cout << *str;
  19. print(str+1);
  20. }
  21. }
  22.  
  23. int main()
  24. {
  25. const char str[]="Roses are red";
  26. print(str);
  27. cout << endl;
  28. tnirp(str);
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Roses are red
der era sesoR