Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Reverse operations with out temporary variable and in-built functions like string reverse.
with out temporary variable
You can do it using XOR logic like 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; }
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
with out temporary variableactually I don't suppose such solutions exist..