反转字符串(c语言迭代版)
#include<stdio.h> void fun(char *str,int len){ for(int i=0;i<len/2;i++){ char temp = str[i];str[i] = str[len-1-i]; str[len-1-i] = temp; } for(int i=0;i<len;i++){ printf("%c",str[i]); } } int main(){ char s[] = {'a','b','c','d','e'}; fun(s,5); return 0; }