//两个指针#include 
#include 
char* Reverse(char * s){                 char* left=s ;                 char* right=s ;                 while(*right)                                right++;                right--;                 while(right>left)                {                                 //swap—>创建临时变量                                 /*char tmp=*left;                                *left=*right;                                *right=tmp;*/                                 //swap—>异或                                *left=*left^*right;                                *right=*left^*right;                                *left=*left^*right;                                left++;                                right--;                }                 return s ;}void test(){                 char str[]="hello,world-coming!" ;  //注意此处不能用char* str="hello,world-coming!",因为指针存于常量区,不能去改变它                printf( "%s\n",Reverse(str));}int main(){                test();                system( "pause");                 return 0;}递归//#include 
//#include 
//#include 
////void Reverse(char* str,int left,int right)//{//             if(left>=right)//                             return;////             char tmp=str[left];//             str[left]=str[right];//             str[right]=tmp;////             Reverse(str,left+1,right-1);//}//void test()//{//             char str[]="hello,world-coming!";//             int len=strlen(str)-1;////             Reverse(str,0,len);////             printf("%s\n",str);//}//int main()//{//             test();//             system("pause");//             return 0;//}数组//#include 
//#include 
//#include 
////char* Reverse(char* str,int left,int right)//{//             while(left

结果:

#include 
#include 
int SubStr(char dst[],char src[],int start,int len){                 char* first=src +start;                 char* end=src +start+len;                 int i=0;                 while(*first && first

结果:

#include 
#include 
void test(){                 int c;                 while((c=getchar())!='\n' )                {                                 if(c>='A' && c<='Z')                                                c+=32;                                putchar(c);                }                printf( "\n");}int main(){                test();                system( "pause");                 return 0;}

结果:

#include 
#include 
void test(){                 int c;                 while((c=getchar())!=EOF )                {                                 if(c>='A' && c<='z')                                                c= 'A'+'z' -c;                                putchar(c);                }}int main(){                test();                system( "pause");                 return 0;}

结果:

#include 
#include 
#include 
//把dst当成一个指针//char* Strcpy(char* dst,const char* src)//{//             assert(src);//             int i=0;////             while(*src)//             {//                             dst[i++]=*src++;//             }////             dst[i]='\0';////             return dst;//}//把dst当指针char* Strcpy(char * dst,const char* src){                assert(src);                assert(dst);                 char* d=dst;                 while(*src)                                *d++=*src++;                *d= '\0';                 return dst;}//库函数的实现方法//char* Strcpy(char* dst,const char* src)//{//             assert(src);//             assert(dst);//             char* d=dst;  //先保存住dst的首地址,让d移动////             while((*d++=*src++)!='\0')//                             ;////             return dst;//}void test(){                 char* str="hello world,change the WORLD" ;                 char dest[100];                printf( "%s\n",Strcpy(dest,str));}int main(){                test();                system( "pause");                 return 0;}

结果: