writes:
> Hi,
> If the function signature is like this:
>
> int func( int arr[] );
>
> Or this:
>
> int func ( int* arr );
>
> Then inside the function I have no way to know the size of the
> array, is that right?
Yes.
> So this means that I must change the signature so that the caller of
> this function must provide the size.
That is the most flexible solution. You *might* be able to get away with:
(a) A globally known size -- this might just work if, say, you program
is modeling n-dimensional vectors and matrices. You might be able to
make "n" a compile-time constant (#define is the way to do this).
(b) Some kind of sentinel value you always place at the end of the
array so that functions know when to avert their eyes. Personally I
_hate_ such things, but they have their place (no pun intended).
--
Ben.