C语言填空:利用指针形成逆序字符串函数
#include <stdio.h> 【1】 //逆序输出任意字符串 void severse_string(char【2】str) { int len = strlen(str); char* left = str; char* right = str + len - 1; while (left < right) { char tmp = *left; *left = *right; *right = tmp; left++; right--; } } main() { char zf[100]; int a,b; 【3】; severse_string(【4】); 【5】; getchar(); }
#include <stdio.h> #include <string.h> //逆序输出任意字符串 void severse_string(char* str) { int len = strlen(str); char* left = str; char* right = str + len - 1; while (left < right) { char tmp = *left; *left = *right; *right = tmp; left++; right--; } } main() { char zf[100]; int a,b; gets(zf); severse_string(zf); puts(zf); getchar(); }