c - Not understanding the difference between *p[3] and (*p)[3] -


in book, has been written *p[3] declares p array of 3 pointers. got it. (*p)[3] has been written (*p)[3] declares p pointer array of 3 elements. mean? there no example (*p)[3]. can give me example of it??

int a[3] = {1,2,3}; int (*p)[3]; p=&a;     printf("%d %d %d",(*p)[0],(*p)[1],(*p)[2]);  

at first have understand difference between a , &a. value of both a , &a same. there huge difference in meaning of them. here a represent first element of array i.e. &a[0] , &a represent whole or complete array. if a+1 find address of next element in array i.e. &a[1] if perform &a+1, give next address complete array i.e. here &a+1 = &a[2]+1. here p=&a means have assigned address of array of size 3 pointer p.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -