[A89] Re: Pointers and Matricies
[Prev][Next][Index][Thread]
[A89] Re: Pointers and Matricies
Isn't matrix1 already a (constant) pointer itself? If so, don't use the
address-of operator when assigning a pointer to the matrix pointer.
I'm only going by what I'm currently reviewing of C++ syntax...
- JayEll
In a message dated 2/22/01 1:49:54 PM Mountain Standard Time,
CalenWakefield@aol.com writes:
> If I have a matrix such as thus:
>
> char matrix1[5][5]=
> {{0,0,0,0,0}{0,0,0,0,0}{0,0,0,0,0}{0,0,0,0,0}{0,0,0,0,0}};
>
> and I also have a pointer, thus:
>
> char * pmatrix1 = &matrix1;
>
> How would I go about referencing a single element in the matrix using ONLY
> the pointer?
> I tried doing this:
>
> pmatrix[1][1]=1;
>
> But that doesn't work. Can someone help me out? Much appreciation!
>