[英]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? 这仅给我第一个值,但是如何获取数组中的所有值?
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
. points
指向serieLine
的第一行。 If you increment points
, it will point to the next row. 如果增加points
,它将指向下一行。
递增指针,它将指向数组中的下一个值(因此,一旦将其递增8 * 80次,您将看到所有值)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.