I'm a little stuck with my school project.
So I need to make a dynamic 2-dimensional array.
It has to be created in a function with 3 parameters: 2-dimensional char array, length and width.
This is what I have so far. Length and width come from another function and there are no problems with that. I feel like I am very close but I don't know how do I save the array to theArray[][]
and do I need to create a new variable for where i put /*what here?*/
.
Didn't find anything this specific from the web(maybe I just don't know what to search exactly)
Thanks in advance!
void doArray(char theArray[][], unsigned int length, unsigned int width) {
char** /*what here?*/ = new char*[lenght];
for(unsigned int i = 0; i < length; i++){
/*what here?*/[i] = new char[width];
}}
int main() {
unsigned int lenght = 0;
unsigned int width = 0;
char theArray[][];
size(lenght, width);
doArray(theArray, lenght, width);}