I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my pointers, but I'm not sure. Please help.
The code:
void equate(matrix *A, matrix *B)
{
int i, j;
assert(A.row_dim == B.col_dim && A.col_dim == B.col_dim);
for(i=0; i < A.row_dim; i++)
for(j=0; j < A.col_dim; j++)
A.element[i][j] = B.element[i][j];
}
A and B are supposed to be two different matrices that I will be setting equal to each other...I guess it's sorta like the classic "Swap Function" problem.
The Error:
create.h: In function `void equate(matrix*, matrix*)':
create.h:115: request for member `row_dim' in `A', which is of non-aggregate
type `matrix*'
create.h:115: request for member `col_dim' in `B', which is of non-aggregate
type `matrix*'
create.h:115: request for member `col_dim' in `A', which is of non-aggregate
type `matrix*'
create.h:115: request for member `col_dim' in `B', which is of non-aggregate
type `matrix*'
create.h:117: request for member `row_dim' in `A', which is of non-aggregate
type `matrix*'
create.h:118: request for member `col_dim' in `A', which is of non-aggregate
type `matrix*'
create.h:119: request for member `element' in `A', which is of non-aggregate
type `matrix*'
create.h:119: request for member `element' in `B', which is of non-aggregate
type `matrix*'
Thanks