Get address for an array element
Solution 1
glGenBuffers(1, &(vboIds[1]));
or what Armen said,
glGenBuffers(1, vboIds + 1);
Solution 2
Yes, it would be correct if you remove one ampersand.
You could also write glGenBuffers(1, vboIds + 1);
.
Solution 3
glGenBuffers(1, vboIds + 1);
VansFannel
I'm software architect, entrepreneur and self-taught passionate with new technologies. At this moment I am studying a master's degree in advanced artificial intelligence and (in my free time ) I'm developing an immersive VR application with Unreal Engine. I have also interested in home automation applying what I'm learning with Udacity's nanodegree course in object and voice recognition.
Updated on November 29, 2020Comments
-
VansFannel over 3 years
I'm developing a C program and I have a question about pointers and arrays.
I have the following
arraypointer: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.