简体   繁体   中英

in c, what does mean sizeof()..[-1]

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM