summaryrefslogtreecommitdiff
path: root/test/regression/ptrs2.c
blob: 0b66ed2cb508b8d8c9b046ecced1e1990e693bdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdlib.h>

typedef double Matrix[4][4];

Matrix * CopyMatrix(Matrix * Mat) {
  int i,j;
  Matrix * Res = NULL;
  if (Mat == 0) return Mat;
  Res = malloc(sizeof(Matrix));
  for(i=0;i<4;i++){
    for(j=0;j<4;j++){
      (*Res)[i][j] = (*Mat)[i][j];
    }
  }
  return Res;
}

Matrix * IdentMatrix(void)
{
  Matrix SI = { { 1.00, 0.00, 0.00, 0.00 }, 
		{ 0.00, 1.00, 0.00, 0.00 },
		{ 0.00, 0.00, 1.00, 0.00 },
		{ 0.00, 0.00, 0.00, 1.00 }};
  return CopyMatrix(&SI);
}