Hello,
i'm so new to the C malloc() so i need some programer supervission on it. In the dynamic allocation of memory using malloc() to return the value of a proper type is it proper to do something like the following:
int **space;
// allocates memory space
for(i=0, i<n; i++)
space = (int*)malloc(n * sizeof(int*));
-----------------------------
| | | | | | | |
| | | | | | | |
-----------------------------
does this next code also creat a parall array
or do i have to reallocate another memory space as i did befor?
space=(int*)malloc(sizeof data);
if I have misunderstood parrall array please redirect me.
Thank to all
i'm so new to the C malloc() so i need some programer supervission on it. In the dynamic allocation of memory using malloc() to return the value of a proper type is it proper to do something like the following:
int **space;
// allocates memory space
for(i=0, i<n; i++)
space = (int*)malloc(n * sizeof(int*));
-----------------------------
| | | | | | | |
| | | | | | | |
-----------------------------
does this next code also creat a parall array
or do i have to reallocate another memory space as i did befor?
space=(int*)malloc(sizeof data);
if I have misunderstood parrall array please redirect me.
Thank to all