#include
#include
int main()
{
char b1[8]="abcdef", b2[8], *pb=b1+4;
while (--pb>=b1)
{
strcpy(b2,pb);
puts(b2);
}
printf("%d\n",strlen(b2));
return 0;
}
#include
#include
int main()
{
char b1[8]="abcdef", b2[8], *pb=b1+4;
while (--pb>=b1)
{
strcpy(b2,pb);
puts(b2);
}
printf("%d\n",strlen(b2));
return 0;
}
https://blog.csdn.net/magic_world_wow/article/details/79662257 看这个文章里面的图。
strcpy关键需要你理解的是,从哪里开始拷贝(pb指针开始)到哪里结束拷贝(pb指针后面遇到0),以及拷贝到哪里(b2指针顺延),以及pb和b2指针重叠。