Getting the length of an array
Dear friends.
When I allocate memory for an array, can I afterwards get an information about the size of the allocated memory?
The background is a simple function named vectorsum, that I programmed.
That is:
Code:
vectorsum(float* vector,int length)
{
int i=0;
float sum=0;
for(i=0;i<length;i++)
sum+=vector;
return sum;
}
I find it a bit stupid, that I have to give the length to the function and it is also bad, that it is restricted to one data type (float*).
I would be glad to get a fast answer from you.
Thank you in advance.
Pharao