Clarfication on pointer arithmetic
*(*(p+a)+b)
If a*size is added to an address (p), then why is b*size added to *(p+a)? *(p+a) appears to b开发者_StackOverflow社区e the value at that location and adding b*size to it would change its value, not the address. However, based on what I read this is meant to be added to an address.
Given your expression, and assuming you're talking about C, p must be a pointer to a pointer. What happens is:
char ** p;
int a = 2;
int b = 4;
(p+a) // adds 2 * sizeof(char *)
*(p+a) // evaluates to a char *
char * c = *(p+a)
(c+b) // adds 4 * sizeof(char)
*(c+b) // evaluates to a char
精彩评论