I have matrix M:
float M[4][3] = {
0, 0, 0,
0, 1, 1,
1, 0, 1,
1, 1, 0};
And I need to cast M with the purpose of use the method "foo":
foo(float **matrix){
printf("%f",matrix[0][0]);
}
I compiled sucessfully the code using:
foo( (float**) M )
But when I executed it, I got a segment fault. What is wrong? I am using g++ in Ubuntu Oneiric.
Thanks in advance.
Ok, thanks Luchian, but what about using:
float **M = new float*[4];
M[0] = {0,0,0};
I know that it does not compile, but there it something similar?