"Brett McCoy" <[EMAIL PROTECTED]> wrote:
> On 10/13/07, lakapoor <[EMAIL PROTECTED]> wrote:
> > void add(int *m,int *n,int row,int col)
> > {
> > int i,j,c[3][3];
> > for(i=0;i<row;i++)
> > { for(j=0;j<col;j++)
> > {
> > *(c+i*col+j)=*(m+i*col+j)+*(n+i*col+j);
> > }
> > }
> > for(i=0;i<row;i++)
> > { printf("\n");
> > for(j=0;j<col;j++)
> > {
> > printf("%d",*(c+i*col+j));
> > }
> > }
> > }
> > here the line *(c+i*col+j)=*(m+i*col+j)+*(n+i*col+j);
> > is giving the error lvalue required.what does it mean
>
> You can't have an expression as an lvalue
You most certainly can...
int i, *p = &i;
*p = 42;
The problem here is that c is a an array of arrays and
*(c + ...) has array type.
Why the OP isn't just writing c[i][j] = ... I don't know.
--
Peter