在代码中,我通常会使用:
#include <stdlib.h>
void dref1(char **blah)
{
(*blah)[0] = 'a';
(*blah)[1] = 'z';
(*blah)[2] = 0x00;
}
/* or */
void dref2(char **blah)
{
char *p = *blah;
*p++ = 'w';
*p++ = 't';
*p = 0x00;
}
int main(void)
{
char *buf = malloc(3);
dref1(&buf);
puts(buf);
dref2(&buf);
puts(buf);
free(buf);
return 0;
}
我的问题是是否有可能/如何直接取消引用和增加指针:
**blah = 'q'; /* OK as (*blah)[0] ? */
(*blah)++; /* Why not this? */
*((*blah)++) = 'w'; /* ;or. */
...