Current Events > How do you cast a pointer to a c++ array to a 2d array

Topic List
Page List: 1
MJ_Max
07/31/17 3:25:38 PM
#1:


Jesus christ I just wanna use 2d array syntax on my dynamically allocated 1d array

Why is c++ so shitty
... Copied to Clipboard!
MJ_Max
07/31/17 3:28:29 PM
#2:


If the 1d array is "double* array1d" can I just do "double** array2d = (double**)array1d"?
... Copied to Clipboard!
luigi13579
07/31/17 3:30:50 PM
#3:


I'm not totally sure exactly what you want to do, but the & operator gives the address of a variable.

So,

double **array2d = &array1d;
... Copied to Clipboard!
frozenshock
07/31/17 3:48:53 PM
#4:


Learn python or basic if c++ is too hard
---
I don't hate people, people hate me.
... Copied to Clipboard!
MJ_Max
07/31/17 3:58:43 PM
#5:


frozenshock posted...
Learn python or basic if c++ is too hard

I know python and basic and they're not suited to my needs right now
... Copied to Clipboard!
MJ_Max
07/31/17 4:07:58 PM
#6:


Okay I guess dynamically allocated 2d arrays aren't actually contiguous so a cast wouldn't work? fuckerino
... Copied to Clipboard!
Topic List
Page List: 1