fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void all_lower(char* input)
  5. {
  6. if ( *input == 0 ) {
  7. return;
  8. }
  9.  
  10. if ( *input >= 'A' && *input <= 'Z') {
  11. *input += 32; // convert capital letter to lowercase
  12. }
  13.  
  14. all_lower(++input); // simply move to next char in array
  15. }
  16.  
  17. int main()
  18. {
  19. char test[] = "TEST";
  20. cout << "Before: " << test << endl;
  21. all_lower(test);
  22. cout << "After: " << test << endl;
  23. return 0;
  24. }
Success #stdin #stdout 0s 4360KB
stdin
Standard input is empty
stdout
Before: TEST
After: test