[ create a new paste ] login | about

Link: http://codepad.org/qbL9zrTc    [ raw code | output | fork ]

AaronMiller - C, pasted on May 8:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>

/*
 * http://www.opengl.org/archives/resources/faq/technical/transformations.htm#tran0005
 */

int M[4][4] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };

void PrintM(int i, int j, int k) {
  printf("M[%i][%i] = %i; M[%i] = %i;\n", i,j,M[i][j], k, ((int *)M)[k]);
}

int main() {
  printf("sizeof(M) = %i\n\n", (int)sizeof(M));

  PrintM(3,0, 12);
  PrintM(3,1, 13);
  PrintM(3,2, 14);

  return 0;
}


Output:
1
2
3
4
5
sizeof(M) = 64

M[3][0] = 12; M[12] = 12;
M[3][1] = 13; M[13] = 13;
M[3][2] = 14; M[14] = 14;


Create a new paste based on this one


Comments: