#include<stdlib.h>
#include<stdio.h>
int main(){
int row;
int col;
int i=1;
double ** doubleNode;
// *(*(doubleNode+row)+coln)
doubleNode=malloc(sizeof(double)*4);
*doubleNode=malloc(sizeof(double *)*4);
for(row=0; row <4; row++){
for(col =0; col<4;col++){
*(*(doubleNode+row)+col)=i;
i++;
}
}
free(doubleNode);
free(*doubleNode);
return 0;
}
this is a test code for a double pointer. it compiles fine with gcc, but when i run it. it gives me segmetation fault. do u know where i did wrong?
thanks