Difference between int (*b)[5] and int *{b[5]}

Diff btw int (*b)[5] and int *{b[5]}

4Comments
Arvind Rawat @arvind.rawat
16 Dec 2014 10:41 am

int (*b)[5] means that b is a pointer to an array of 5 integers.

int *b[5] means that b is an array of 5 integer pointers.

Bhupathi Vaibhav @kiranvaibhav
16 Dec 2014 11:47 am

Thank you that helped. You mean 2nd one is 2d array right i.e.5*5

 

Arvind Rawat @arvind.rawat
16 Dec 2014 03:29 pm

Yes, the 2nd one represents 2d array of integers, but the dimensions are not 5*5. Since, we only know one dimension i.e. 5, there is no information about the other dimension.

Bhupathi Vaibhav @kiranvaibhav
17 Dec 2014 09:10 am

Ya got it. Thanks a lot.

Pages