Untitled

 avatar
unknown
plain_text
2 years ago
332 B
7
Indexable
int matrixMemoryAllocate(int*** matrix, int rows, int cols){
    
    int i;
    *matrix = (int**) malloc(sizeof(int*) * rows);
    
    if (*matrix == NULL) return 0;
    
    for (i = 0; i < rows; i++){
        (*matrix)[i] = (int*) malloc(sizeof(int) * cols);
        if((*matrix)[i] == NULL) return 0;
    }
    
    return 1;
}
Editor is loading...