/* create big matrix */ DO_INLINE fmatrix3x3 *create_bfmatrix(void) { // TODO: check if memory allocation was successfull */ return MEM_callocN (sizeof (fmatrix3x3) * (CLOTHPARTICLES + CLOTHSPRINGS), "cloth_implicit_alloc_matrix"); } ...later call: fmatrix3x3 *matrix = create_bfmatrix(); for(i = 0; i < CLOTHPARTICLES; i++) { printf("iA: %d\n", i); cp_fmatrix(matrix[i].m, m3); } for(i = CLOTHPARTICLES; i < CLOTHPARTICLES+CLOTHPARTICLES; i++) { printf("iB: %d\n", i); cp_fmatrix(matrix[i].m, tmatrix); }