String swapping

Output:
Input name:Kitty
yittk

Thanks

Recommended Answers

All 2 Replies

Take input in an char array and swap the positions.Hold two pointers say i and j i pointing to 0 and j to last input character position.Swap arr and arr[j] and then i++,j--;then again swap until i=j.

Take input in an char array and ......

To mention: a char array is not the only possibility, using a string is also possible :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.