HI all,
I'm trying to compile the following code:
The function is supposed to fill a matrix with the Fibonacci sequence.Code:void fibFillMat(int mat[][COL], int n) { int position=1; int temp=1; int i; **mat=0; //First number is zero for(i=1;i<=n;i++) { *(*(mat+i))=(position*i); position+=temp; //finds next relevant position temp=*(*(mat+i)); *(mat+i)+=(position-temp); //moves the pointer to next relevant position } }
The error i get is:(I use Eclipse for Linux)."invalid operands to binary + (have ‘int[3]’ and ‘int’)"
I'm obviously new to this pointers thing, but i'm pretty sure *(mat+i) points to another pointer wich i can increment, right?
so i can't understand why it's not compiling.