I'am stuck on the following error:
test.c:9: error: subscripted value is neither array nor pointer
I think I am doing something wrong with the variable rot[0][0], but I can't quite figure out what or why. I reduced my code to the code below. I am using "gcc test.c -o test" to compile the code. Any help would be appriciated.
Regards,
Harry
Expand|Select|Wrap|Line Numbers
- typedef float Rot_matrix[3][3];
- typedef float Vector[3];
- int main(void){
- Rot_matrix Rot[9];
- float *rot = (float *)Rot[4];
- Vector j = {1, 2, 3};
- Vector *i = (Vector *) j;
- (*i)[0] = rot[0][0];
- return 0;
- }