#include<stdio.h>
void AntitoneValue(char* father, char* child)
{
int i,j=strlen(father);
printf("%d\n",j);
for(i=0; i<j; i++)
child[i]=father[j-1-i];//反续
child[i] = '\0';
}
int main()
{
char s[]="hwelloadfefwfe",s2[100];
AntitoneValue(s,s2);
printf("invert is %s",s2);
return 0;
}
函数功能:将字符串的字符,反过来打印。
这里要注意的是,求字符串长度要用strlen函数,如果用sizeof,求出来的是char型指针所占内存的长度,即4.