Vanya
Vanya

Reputation: 5005

C++ conversion from array to pointer

I am bit struggling with kinda easy task. I need to convert array to pointer.

GLfloat serieLine[8][80];

GLfloat *points = &serieLine[0][0];

this gives me just first value, but how can I get all values in the array?

Upvotes: 1

Views: 281

Answers (2)

digital_revenant
digital_revenant

Reputation: 3324

If you want pointer to an array, you can do it like this:

GLfloat (*points)[80] = serieLine;

points will point to the first row of serieLine. If you increment points, it will point to the next row.

Upvotes: 4

benjymous
benjymous

Reputation: 2122

Increment the pointer, and it'll point at the next value in the array (so once you've incremented it 8*80 times you'll have seen all of the values)

Upvotes: 3

Related Questions