Mercurial > hg > CbC > CbC_examples
view matrix/matrix.c @ 2:35d6eabeadb0
modify Makefile. we can use makefile to compile outside CbC examples. (some examples are not compilable...)
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 22 Oct 2014 02:06:29 +0900 |
parents | bacef8675607 |
children |
line wrap: on
line source
#include "matrix.h" void *create_matrix(size_t size, int row, int col) { int i; void *body; void **ret; ret = malloc( size*row*col + sizeof(void*)*row ); if (ret==NULL) return NULL; body = (void*)(ret+row); for( i=0; i<row; i++){ ret[i] = body + size*col*i; } return ret; }