Hi there,
I need to change a static allocation of a pointer defined as shown in Code (1) into a dynamic-type allocation.
Specifically, in that described in (1) I am able to assign *vars[] because variable1 is already statically allocated, but for my work I do not know the size of variable1 until a subsequent dynamic allocation that will occur throughout the code, giving me a problem in assigning *vars[] at the beginning.
Also, *vars[] will not contain only variable1, but a series of variables where the amount of these variables is also decided only inside the code.
Is anyone able to help? I hope I made the questioning clear; if this is not the case, please ask me more of what you need.
Thank you in advance
All the best
Code (1):
Cose(2): What I need to obtain:Code:float variable1[n][m]; float *vars[] = {(float*)variable1};
Code://Declaration of matrix "variable": float **variable; //Dynamic allocation of **variable through the code after getting the value of m and n: variable = matrix(0,m, 0,n); //Now I want to finally assign *vars[] with the new allocated variable1, but I //do not know how to do this by using a formulation similar to: float *vars[] = {(float*)variable1};



LinkBack URL
About LinkBacks



