Muh*_*rma 1 c size int pointers
我想了解下面的代码片但是我无法解决它,(特别是)
void fun(char **p)
{
char *t;
t = (p+= sizeof(int))[-1]; //especially this line,why there is "-1" in here?
printf("%s\n", t);
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的时间.
该
t = (p+= sizeof(int))[-1];
Run Code Online (Sandbox Code Playgroud)
可以改写为
p += sizeof(int); /* The logic of this doesn't make a whole lot of sense to me */
t = *(p - 1);
Run Code Online (Sandbox Code Playgroud)
希望这可以解决问题.