You can't. In C, when you pass an array to function, it decays
from an array to a pointer-to-type, so far as the function's scope is concerned.
So, consider this:
int arr[16];
sizeof(arr); // sizeof WORKS
myFunction(arr); // Array decays to pointer, sizeof FAILS inside function
myFunction(&arr[0]); // Array decays to pointer, sizeof FAILS inside function
void myFunction(int* ptr)
{
// sizeof(ptr) will not give you what you would expect normally
}
The traditional way to do this in C is to have an extra function parameter, ie:
void myFunction(int* ptr, size_t mySize)
{
}
Or, create your own structure that holds the pointer to the array and it's size, ie:
typedef struct myType {
int* ptrToArray;
size_t arraySize;
} myType_t;
int array[16] = { 0 };
myType_t data;
data.ptrToArray = array;
data.arraySize = 16;
void myFunction(myType_t data)
{
}