Linux 系统编程实战——指针(一些有意思的代码)

                  

                

 1 #include<stdio.h>
 2 #include<string.h>
 3 #include<stdlib.h>
 4 
 5 void reverse(char *p) {
 6    if('\0' == *p) {
 7          return;
 8     }     
 9    
10    reverse(p+1); //这里不能够用++p,第一次p就会被赋值为e,因此最后输出为 olle,h不会被输出
11    printf("%c", p);
12 }
13 
14 int main() {
15    reverse("Hello");
16    
17    return 0;
18 }

                

相关文章
相关标签/搜索