百度网站推广怎么样,如何让网站互动起来,泗阳县住房和城乡建设局网站,建设局电工证与安监局电工证C程序设计语言 #xff08;第二版#xff09; 练习 4-13
练习 4-13 编写一个递归版本的reverse(s)函数#xff0c;以将字符串s倒置。
注意#xff1a;代码在win32控制台运行#xff0c;在不同的IDE环境下#xff0c;有部分可能需要变更。
IDE工具#xff1a;Visual S…C程序设计语言 第二版 练习 4-13
练习 4-13 编写一个递归版本的reverse(s)函数以将字符串s倒置。
注意代码在win32控制台运行在不同的IDE环境下有部分可能需要变更。
IDE工具Visual Studio 2010 代码块
#include stdio.h
#include stdlib.hstatic int i 0;
static int j 0;void reverse(char s[]){char c \0;if(s[i] ! \0){c s[i];reverse(s);}if(j i c ! \0){s[j] c;}
}int main(){char s[] hello world!;reverse(s);printf(%s\n, s);system(pause);return 0;
}