In C++, is there a way to convert a float**
to a float[][]
type? I also would like to know how to convert it the other way around too.
You don't need to convert anything. Just dereference it by [][]
:
float **a;
// allocate memory //
a[0][0] = 1;
Be careful to don't touch out-of-bound items which didn't allocate.
you can look here to see some more examples, but basically as MM said, you don't need to convert and you can always do:
int x[10];
int *y = x;
same with 2 dimensional arrays
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.