Listing 4 Example of different styles of looping functions

void add(int count, float *a, float *b, float *result)
{ /* fortran */
       int i;
       for(i =0;i<count;++i)
          result[i] = a[i] +b[i];
}

void add(int count, float *a, float *b, float *result)
{ /* UDI */
       while (count--)
          *result++ = *a++ + *b++;
}

void add(int count, float *a, float *b, float *result)
{ /* Csound */
       do
       {
          *result++= *a++ + *b++;
       }while(--count);
}

void add(int count, float *a, float *b, float *result)
( /* Resound */
       float *end = result+count;
       while(result<end)
       {
          *result++ = *a++ + *b++;
       }
}

void add(int count, float *a, float *b, float *result)
{ /* Ptolemy */
       int i;
       for(i=count-1;i >=0;--i)
          result[i] = a[i] +b[i];
}

/* End of File */