Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actual_Slin_

Posted 14 February 2013 - 07:12 PM

No, vertices is an array and sizeof(vertices) correctly returns its size.

If you do something like this: GLint vertices[] = {x0y0x1y0x1y1x0y1x0y0};

the value of "vertices" will be the address of the first element and the [index] operator does not do anything else but some pointer arithmetic to access the elements. You can access the first element as *vertices. vertices should have the type GLint* and sizeof should return the according size.

If I am wrong, I will of course accept that, but that would kinda destroy everything I thought understood about programming...

 

Edit: Okay, I googled and tried it myself and actually sizeof returns the correct array size :)


#1_Slin_

Posted 14 February 2013 - 07:02 PM

No, vertices is an array and sizeof(vertices) correctly returns its size.

If you do something like this: GLint vertices[] = {x0y0x1y0x1y1x0y1x0y0};

the value of "vertices" will be the address of the first element and the [index] operator does not do anything else but some pointer arithmetic to access the elements. You can access the first element as *vertices. vertices should have the type GLint* and sizeof should return the according size.

If I am wrong, I will of course accept that, but that would kinda destroy everything I thought understood about programming...


PARTNERS