简体   繁体   中英

Difference between const int* ptr[] and const int (*ptr)[]

Is there any difference between

const int* ptr[5];

and

const int (*ptr)[5];

?

I am trying to point to a const 5*5 2D int array, but I am not sure of the best way to do it

const int* ptr[5];

This is an array of five elements, each element is a pointer to const int .


const int (*ptr)[5];

This is a pointer to an array of five elements, each element is a const int .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM