I have:
#include <stdio.h>
typedef float mat4f[16];
void logMat(mat4f in) {
    int i;
    for (i=0; i<16; i++) {
        //in[i] = i; //uncomment this line and it works as expected
        printf("%2d: %f\n", i, in[i]);
    }
}
int main(void) {
    mat4f a;
    logMat(a);
    return 0;
}
When I run this, the elements at index 4 and 12 often appear corrupted. Some examples:
 0: 0.000000
 1: 0.000000
 2: 0.000000
 3: 0.000000
 4: -0.019316
 5: 0.000000
 6: 0.000000
 7: 0.000000
 8: 0.000000
 9: 0.000000
10: 0.000000
11: 0.000000
12: -0.000000
13: 0.000000
14: 0.000000
15: 0.000000
or
 0: 0.000000
 1: 0.000000
 2: 0.000000
 3: 0.000000
 4: 894113943650304.000000
 5: 0.000000
 6: 0.000000
 7: 0.000000
 8: 0.000000
 9: 0.000000
10: 0.000000
11: 0.000000
12: 0.002546
13: 0.000000
14: 0.000000
15: 0.000000
And I get different results just from running it multiple times. However, if I uncomment that one line that you'll see in the source, it works as expected every time.
Can anyone spot my mistake? Why index 4 and 12?
I'm kinda trying to do what was suggested here: stackoverflow.com/a/1810295/1472246
 
     
     
    