[演算法笔记]反轉字串

void reverse(char* s)
{
    int n = strlen(s);
    for (int i=0; i<n/2; i++)
        swap(s[i], s[n-1-i]);
}

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注