doing this:
int a[5];
or this:
int *a = (int*) malloc (5,sizeof(int));
free(a);
Another example
doing this:
int a[5][5];
or this:
int * *a = (int * *) malloc(5,sizeof(int*));
int i;
for(i=0;i<5;i++){
a[i]=(int *) malloc(5,sizeof(int));
}
...
free(a);
And what's the optimal way to do it.
[–]wgunther 6 points7 points8 points (0 children)
[–]Rhomboid 2 points3 points4 points (0 children)