Does
int **p
and
int *p[1]
mean the same thing? as both can be passed to functions allowing the change the pointer object, also both can be accessed via p[0], *p ?
Update, thanks for your help, tough Memory management seems different. does the access mechanism remain the same
*eg: p[0] becomes *(p+0) & *p (both pointing to something)
Thanks
Not quite.
declares a pointer
p, which will be used to point at objects of typeint *, ie, pointers to int. It doesn’t allocate any storage, or pointpat anything in particular yet.declares an array
pof one pointer to int:p‘s type can decay toint **when it’s passed around, but unlike the first statement,phere has an initial value and some storage is set aside.Re. the edited question on access syntax: yes,
*p == p[0] == *(p+0)for all pointers and arrays.Re. the comment asking about
sizeof: it deals properly with arrays where it can see the declaration, so it gives the total storage size.