On Mon, 18 Oct 1999 12:16:32 +0100, Mathew Hendry wrote:

>/* "array" version */
>
>int
>sum_array_ar(int *array, long len) {
>  int sum = 0;
>  long i;
>  for (i = len; i--;)
>    sum += array[i];
>  return sum;
>}

I just noticed that you pass array into the function in pointer
notation but then use it as an array inside the funtion.  I have a C
purist friend who claims that this is bad and has test cases where
this can cause problems.  Although I can't remember what they were.
(I will forward it to him and ask and post the results)  I think it
has to do with multi-diminsional arrays.

IIRC he claims that the proper function definition should be:

sum_array_ar(int array[SIZE], long len) {


--
Richard A. Smith                         Bitworks, Inc.               
[EMAIL PROTECTED]               501.521.3908                        
Sr. Design Engineer        http://www.bitworks.com   


--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to