M
matthurne
I need to send just an array to a function which then needs to go
through each element in the array. I tried using sizeof(array) /
sizeof(array[0]) but since the array is passed into the function,
sizeof(array) is really sizeof(pointer to first element in array) and
therefore doesn't solve my problem. If I can't calculate the size of
the array, can I go through the elements without knowing the size and
somehow test whether I'm off the end of the array?
through each element in the array. I tried using sizeof(array) /
sizeof(array[0]) but since the array is passed into the function,
sizeof(array) is really sizeof(pointer to first element in array) and
therefore doesn't solve my problem. If I can't calculate the size of
the array, can I go through the elements without knowing the size and
somehow test whether I'm off the end of the array?