fork download
  1. #include <stdio.h> /* printf() */
  2.  
  3.  
  4. void reverse( char str[] )
  5. {
  6. char * ptr = str;
  7.  
  8. while( ptr && *ptr )
  9. ptr++;
  10.  
  11. for( ptr--; str < ptr; str++, ptr-- )
  12. {
  13. *str = *str ^ *ptr;
  14. *ptr = *str ^ *ptr;
  15. *str = *str ^ *ptr;
  16. }
  17. }
  18.  
  19.  
  20. int main( void )
  21. {
  22. char txt[] = "O rato roeu a roupa do rei de Roma";
  23.  
  24. reverse( txt );
  25.  
  26. printf("%s\n", txt );
  27.  
  28. return 0;
  29. }
  30.  
  31. /* eof */
  32.  
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
amoR ed ier od apuor a ueor otar O