[求助]关于while ( *p2++=*(p1+n-1)++);,
为什么错了,书上说这是交简单方法、但我用上却不对
#include<stdio.h>
#include<string.h>
void main()
{ void copystr(char * p1,char *p2,int n );
int m;
char str1[20]={0},str2[20];
printf("\n inpurt string one :\n");
gets(str1);
printf("which character that begin to copy:\n" );
scanf("%d",&m);
if (strlen(str1)<m)
{
printf("Input characters are not enough ,please input again!\n");
gets(str1);
}
else
{
copystr(str1,str2,m);
printf("result: %s\n",str2);
}
}
void copystr(char *p1,char *p2,int n)
{
while ( *p2++=*(p1+n-1)++);
}