There are a couple of solutions, but the easiest is to return the number of elements from GetDataValues.
(More in the spirit of C++ would be to return say a vector<long> instead of an array.)
At present the method GetDataValues is an existing method the API of an application. Therefore, GetDataValues is called to perform some data assignments for usage later. So I was wondering if I could know the length of the array assigned by GetDataValues. Thank you for your response.
To ronbutan: How can you declare an array without specifying its size directly or indirectly?
Tell me the whole problem you want to solve and also the whole code from upper left corner to lower right corner. I think your problem is not clear to answerable extent.
I think your problem is not clear to answerable extent.
Agreed. The purpose of the getDataValues function is unclear. It requires the caller to give it an array and it returns an int. It appears that you want to pass it an uninitialized pointer. What will getDataValues do with the uninitialized pointer? Will it create some memory and dynamically allocate the array which the caller will be in charge of destroying? Perhaps it should simply return the number of elements in the array that it dynamically allocates.