0

I have an 3D array declared like this

unsigned char   ScalingList[3][2][64];

I need to access the elements of ScalingLists using another pointer, something on these lines

unsigned char (*pQM)[2][64];
pQM = &(ScalingList[0][0][0]);

and then index into the elements of ScalingList like this

pQM[i][j][k]

I know I need to have proper combination of (), * and &, but I'm not able to get it. Could someone please help me out..

1
  • @Avi Berger: you are right! Deleting against mis-understandings. Commented Aug 30, 2012 at 18:46

1 Answer 1

2

What you posted looks pretty close to perfect to me. The only issue that I can spot is a type mismatch in the line:

pQM = &(ScalingList[0][0][0]);

The rhs as written is of type unsigned char *.

Try instead:

pQM = ScalingList;

The first dimension will decay to a pointer to the first element - a correctly sized 2-d array.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.