I'm using the sizeof operator to get the size of an array. So: (sizeof array / sizeof array[0] )
But because I have a class with a whole lot of functions, this is where I have a function that does this, which brings me to my problem.
When passed to a function as a pointer, as you do with arrays, it takes array as a pointer to the first element in the array, so the result of the expression is always 1, instead of 17, as it should be .
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
jox: that's actually what I'm doing. I've got a class that just has a whole lot of sorting functions in it. And I'm trying to find a way to call the functions like this: sort.quickSort( array, sort.sizeOfArray(array) );
Electron: This isn't actually for irrlicht specifically, so I'm not using the irrlicht types.
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
I would suggest std::vector as it is an array that is dynamically resized as needed. It has the size feature and a sort feature that will be much faster than something you write yourself unless you are really good but even then the difference will probibly be quite small.
But to answer your question as you ask it: dereference the pointer to the array in your call to the sizeof function.
Also if this is not irrlicht specific shouldn't it be posted in one of the other sections?