#include <windows.h>
#include <iostream>
using std::cout;
using std::endl;
int main()
{
char *str[]={"Welcome","to","Fortemedia","Nanjing"};
char **p=str+1; //p指向str[1]
str[0]=(*p++)+2; //p指向str[2] str[0]="\0"
str[1]=*(p+1); //str[1]="Nanjing"
str[2]=p[1]+3; //str[2]="jing" 注意:p现在指向str[2],即p[0]="jing"
str[3]=p[0]+(str[2]-str[1]); //str[2]-str[1]=p[1]+3-*(p+1) =3 ,看上两步
printf("%s\n",str[0]);
printf("%s\n",str[1]);
printf("%s\n",str[2]);
printf("%s\n",str[3]);
system("pause");
return 0;
}
打印结果:
我刚看到这个的时候,不晓得有些结果怎么来的,后来认真的到机子上调试了一下,终于明白了!