[ create a new paste ] login | about

Link: http://codepad.org/SrrOLTRi    [ raw code | output | fork ]

C++, pasted on Sep 2:
#include<stdio.h>
#include<string.h>
void ReverseOpr(char *str2,int n){
    char *p=str2+n-1;
    char temp;
    while(str2<p){
        temp=*str2;
        *str2=*p;
        *p=temp;
        ++str2;
        --p;
    }
}
void ReverseString(char * str1){
    ReverseOpr(str1,strlen(str1));
}
int main(){
char *str="nihao";
ReverseString(str);
printf("%s",str);
return 0;
}


Output:
1
2
3
cc1plus: warnings being treated as errors
In function 'int main()':
Line 18: warning: deprecated conversion from string constant to 'char*''


Create a new paste based on this one


Comments: