Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get address for an array element

Tags:

arrays

c

pointers

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.

like image 927
VansFannel Avatar asked Aug 19 '26 12:08

VansFannel


1 Answers

glGenBuffers(1, &(vboIds[1]));

or what Armen said,

glGenBuffers(1, vboIds + 1);
like image 190
Christopher Creutzig Avatar answered Aug 21 '26 02:08

Christopher Creutzig



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!