I'm developing a C program and I have a question about pointers and arrays.
I have the following array pointer:
GLuint *vboIds;
And the following function prototype:
void glGenBuffers(GLsizei n, GLuint *buffers);
The following statement is correct:
glGenBuffers(1, vboIds);
But I want to pass to glGenBuffers the second index of vboIds as second parameter for the function. I have put this:
glGenBuffers(1, &&vboIds[1]);
Is this correct?
Thanks.
GLuint *vboIds;" Wrong, you have the following pointer. Remember, arrays != pointers, there is an extra layer of indirection with pointers using array notation.int foo[10]; int *bar = foo;. When you dofoo[2] = 1;the address of the arrayfoois a known constant and2 * sizeof(int)is added to the address of foo to obtain the value. On the other hand, when you dobar[2] = 1;the first thing that has to happen is a fetch for the value ofbar, deference that value to get to the array and then add2 * sizeof(int)to get the value.