Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between int *a[3] and int (*a)[3]? [duplicate]

Tags:

arrays

c

pointers

I want to know what is a difference between :

int *a[3]; 

And

int (*a)[3]; 

Thanks a lot , good luck .

like image 818
user31587 Avatar asked Jan 14 '23 05:01

user31587


1 Answers

int *a[3] => a is array of int *

(a+1) will point to next integer by with the increment of integer size.

int (*a)[3] => a pointer to array of 3 integers

(a+1) will point to next array of 3 integers, with the increment of (3 * integer size)

to find details read more about pointer to arrays

like image 69
rahul.deshmukhpatil Avatar answered Jan 17 '23 17:01

rahul.deshmukhpatil