C: How to pass a double pointer to a function -


i getting segmentation fault when pass double pointers function initialize memory

int main() {     double **a;     initialize(a, 10, 10);  ...... }  void initialize(double **a, int r, int c) {    = (double **)malloc(sizeof(double *)*r);    for(int = 0; i< r; i++) {         a[i] = (double *)malloc(sizeof(double) *c);         for(int j = 0; j < c; j++) {             a[i][j] = 0.0;         }    } } 

how can pass double pointers functions.....

if want modify pointer pointer need pass pointer pointer pointer.

void func(double ***data) { *data = malloc(sizeof(double*)*10); for.... }; double ** data; func(&data); 

Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -