float** ranges = new float*[2];
ranges[0] = {0,100};
ranges[1] = {0,200};
doesn't work since:
- The RHS is an initilaization list that cannot be assigned to a pointer.
range[0]
and range[1]
are pointers for which memory needs to be allocated first. And then, you can assign values to individual elements.
You can use:
ranges[0] = new float[2]{0,100};
ranges[1] = new float[2]{0,200};
or
ranges[0] = new float[2];
ranges[0][0] = 0;
ranges[0][1] = 100;
ranges[1] = new float[2];
ranges[1][0] = 0;
ranges[1][1] = 200;
Of course, make sure to add code to delete
them.