Possible Duplicate:
determine size of array if passed to function
How can I get the size of a C++ array that is passed to a function?
In the following code, the sizeof(p_vertData)
does not return the correct size of the array.
float verts[] = {
-1.0,1.0,1.0,
1.0,1.0,1.0,
1.0,-1.0,1.0,
-1.0,-1.0,1.0,
-1.0,1.0,-1.0,
1.0,1.0,-1.0,
1.0,-1.0,-1.0,
-1.0,-1.0,-1.0
};
void makeVectorData(float p_vertData[]) {
int num = (sizeof(p_vertData)/sizeof(int));
cout << "output: " << num << endl;
};
What am I doing wrong?