[Solved] #EMERGENCY!!! Run-Time Check Failure #2 – Stack around the variable ‘b’ was corrupted


I haven’t checked your code thoroughly, but you define c as 3×3, and here

for (i = 0; i < 4; i++) {
    printf("[");
    for (j = 0; j < 3; j++) {
        c[i][j] = (a[i][0] * b[0][j]) + (a[i][1] * b[1][j]);

…you access c[3], which is c’s fourth element, and does not exist. This is bound to write somewhere else.

So check your indexes (as @ptb observed, c’s should actually be four rows deep).

solved #EMERGENCY!!! Run-Time Check Failure #2 – Stack around the variable ‘b’ was corrupted