2011.12.3返回类型为指针的函数
#include <iostream>
#include <string.h>
using namespace std;
char b[80];
char *result = b;
char *convert(char *p1)
{
// char *result;
// char b[80];
// result = b;
unsigned short temp = strlen(p1);
unsigned short i = temp - 1;
p1 += i;
for(int j = temp;j > 0; j--)
{
*result++ = *p1--;
}
*result += '\0';
result -= temp;
return result;
}
int main()
{
char a[80];
char *p = a;
cin>>p;
/* char *p = "abc";*/
cout<<convert(p)<<'\n';
}