☆ チン     マチクタビレタ〜
                        マチクタビレタ〜
       ☆ チン  〃  ∧_∧   / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
        ヽ ___\(\・∀・) < >>408 まだ〜?
            \_/⊂ ⊂_ )   \_____________
          / ̄ ̄ ̄ ̄ ̄ ̄ /|
       | ̄ ̄ ̄ ̄ ̄ ̄ ̄|  |
       |  愛媛みかん  |/

typedef double DATATYPE;
typedef struct _matrix MATRIX;
struct _matrix{
int rows;
int cols;
DATATYPE **array;
};
int matrix_init(MATRIX *mat, int rows, int cols){
DATATYPE *data;
size_t data_size = rows*cols*sizeof(DATATYPE);
int i;
mat->rows = rows;
mat->cols = cols;
data = (DATATYPE*)malloc(data_size);
memset(data,0,data_size);
mat->array = (DATATYPE**)malloc(rows*sizeof(DATATYPE*));
for(i=0; i<rows; ++i){
mat->array[i] = data + i*cols;
}
return 1;
}