【发布时间】:2012-09-24 04:14:05
【问题描述】:
以下2个功能本质上是一样的吗?
即,int* 与 int[] 完全相同吗?
int myFunction(int* xVals, int* yVals, int nVertices);
int myFunction(int xVals[], int yVals[], int nVertices);
如何使用第一个功能?即,如何在参数中传递数组?以下是有效/正确的吗?
int xVals[5], yVals[5], zVals[5];
myFunction(xVals, yVals, zVals, 5);
// or should it be..
myFunction(&xVals[0], &yVals[0], &zVals[0], 5);
【问题讨论】:
-
你确定你不是说
int xVals[]? -
@cnicutar 是的,应该是这样的
标签: c++ c function pointers parameters