c - How to reverse a string without using in-built and temporary variables -


reverse operations out temporary variable , in-built functions string reverse.

you can using xor logic this:

char* rev(char* str) {     int end = strlen(str) - 1;     int start = 0;      while (start < end)     {         str[start] ^= str[end];         str[end] ^= str[start];         str[start] ^= str[end];          ++start;         --end;     }      return str; } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -