Reverse in place · Inverter in-place
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.
Inverta in loco
Inverta uma string C in loco — altere os caracteres no mesmo array em vez de construir uma nova string. O movimento clássico: um índice esquerdo no início e um direito no fim, troque-os, depois mova ambos em direção ao centro até se encontrarem.
Complete void reverse_in_place(char *s) to reverse the C-string s in place (modify the same array). Do not write main. · Complete void reverse_in_place(char *s) para inverter a string C s in-place (modificar o mesmo array). Não escreva main.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.