That code won't even compile, let alone give a segmentation fault. As a rough rule, it is better to post ACTUAL functional code in forums (for example, cut and paste from an actual source file) than it is to try to paraphase ot to type it in from memory. You have not posted actual code, so have mucked up, big time.
However, if you want to pass a "pointer to pointer" to a function, and have any changes made visible to the caller, you have to pass a "pointer to pointer to pointer". For example (count the asterixes and ampersands carefully)
Code:
#include<stdio.h>
#include<malloc.h>
void malloc_array(int ***array,int row,int col)
{
int i;
*array=malloc(row*sizeof(int*));
for(i=0;i<row;i++){
(*array)[i]=malloc(col*sizeof(int));
}
}
int main()
{
int **array, row=5, col=7;
malloc_array(&array,row,col);
/* You can now use array here without getting in danger */
}
Incidentally, it is considered bad style to rely on the "implicit int" return type (and such things are deprecated). If a function returns int, write it that way. In C, you should not need to have a type conversion on the return value from malloc().