Declaring a 2D array constant

Feb 11, 2020 at 8:07pm
How do you declare a 2D array constant? FOr example, if we know "that no map will be larger than 500 by 500". Thank you.
Feb 11, 2020 at 8:34pm
const and constexpr mean the data will not change. eg const int x[][] = {{1,2},{3,4}};
x[0][0] = 5; //error, data is constant.

array notation, int x[500][500] means the data can change, but not the dimensions (which means you can use *up to* those dimensions and track how much you used if you like).

I think you meant array notation, with a const max size?
Last edited on Feb 11, 2020 at 8:35pm
Topic archived. No new replies allowed.