I'm trying to copy values from an array of floats to a 4x4 floats matrix but keep getting this annoying error "incompatible types when assigning to type ‘float[4]’ from type ‘float’" please help me...
This is the typedef:
typedef float mat[4][4];
and then the function goes like this:
void function_Read(mat *matrixPointer, float *arrayOfFloats) {
int indexOfArray;
int rowIndexOfMatrix = 0;
int columnIndexOfMatrix = 0;
int sizeOfArrayOfFloats = sizeof (arrayOfFloats) / sizeof (arrayOfFloats[0]);
for (indexOfArray = 0; indexOfArray < sizeOfArrayOfFloats; indexOfArray++) {
/* the line below causes the error */
matrixPointer[columnIndexOfMatrix][rowIndexOfMatrix] = arrayOfFloats[indexOfArray];
columnIndexOfMatrix++;
if (columnIndexOfMatrix == 4) {
columnIndexOfMatrix = 0;
rowIndexOfMatrix++;
}
if (rowIndexOfMatrix == 4) {
rowIndexOfMatrix = 0;
}
}
}
Plus, can someone add a link to a document for advanced pointers stuff in c ? I'm always letting the debugger flash errors and then I correct them sometimes without even understanding the problem.
Thanks !