Reputation: 19
I am trying to understand the code piece below But I could not solve it,(especially )
void fun(char **p)
{
char *t;
t = (p+= sizeof(int))[-1]; //especially this line,why there is "-1" in here?
printf("%s\n", t);
}
thanks for your time.
Upvotes: 1
Views: 176
Reputation: 500327
The
t = (p+= sizeof(int))[-1];
can be rewritten as
p += sizeof(int); /* The logic of this doesn't make a whole lot of sense to me */
t = *(p - 1);
Hope this clears things up.
Upvotes: 5