c - Clarfication on pointer arithmetic -
*(*(p+a)+b)
if a*size added address (p), why b*size added *(p+a)? *(p+a) appears value @ location , adding b*size change value, not address. however, based on read meant added address.
given expression, , assuming you're talking c, p must pointer pointer. happens is:
char ** p; int = 2; int b = 4; (p+a) // adds 2 * sizeof(char *) *(p+a) // evaluates char * char * c = *(p+a) (c+b) // adds 4 * sizeof(char) *(c+b) // evaluates char
Comments
Post a Comment