/*
百度笔试题:
编程: 
用C语言实现一个revert函数,它的功能是将输入的字符串在原串上倒序后返回。
*/
#include
<stdio.h>
void f(char* s){
    
if(*s=='\0')
        
return;
    
char temp;
    
char* end=s;
    
while(*((++end))!='\0');
    end
--;
    
char* start=s;
    
while(start<end){
        temp
=*start;
        
*(start++)=*end;
        
*(end--)=temp;
    }
}
int main(){
    
char a[10]="123456789";
    f(a);
    puts(a);
    
char b[1]="";
    f(b);
    puts(b);
}
posted on 2009-06-04 13:34  CUCmehp(likesmiles)  阅读(516)  评论(0编辑  收藏  举报