Search code examples
c++pointersconventions

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?


Solution

  • 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.