Skip to content

Reverse in place · ⁨原地反转⁩

English

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.

中文

原地反转

原地反转 C 字符串 —— 直接修改同一个数组里的字符,而不是新建字符串。经典做法:一个左下标在开头,一个右下标在结尾,交换它们,然后两个下标都向中间移动,直到相遇。

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩