27,373
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
int main(void)
{
char *str[] = {"welcome","to","fortemedia","Nanjing"};
char **p = str+1;
str[0] = (*p++)+2;
str[1] = *(p+1);
str[2] = p[1]+3;
str[3] = p[0] + (str[2]-str[1]);
printf("%s\n",str[0]);
printf("%s\n",str[1]);
printf("%s\n",str[2]);
printf("%s\n",str[3]);
return 0;
}
void TestPoint(void)
{
char *str[] = {"welcome","to","fortemedia","Nanjing"};
char **p = str+1; // to
str[0] = (*p++)+2; // 先运行 () 中的,再 +2,后 p 等于 fortemedia
str[1] = *(p+1);
str[2] = p[1]+3;
str[3] = p[0] + (str[2]-str[1]);
printf("%s\n",str[0]); // NULL
printf("%s\n",str[1]); // Nanjing
printf("%s\n",str[2]); // jing
printf("%s\n",str[3]); // g
}