Reverse in place
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
Reverse in place
Reverse a C-string in place — change the characters in the same array rather than building a new string. The classic move: a left index at the start and a right index at the end, swap them, then step both toward the middle until they meet.
Complete void reverse_in_place(char *s) to reverse the C-string s in place (modify the same array). Do not write main.
Click Run to see the output here.