home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 1 / FishNMoreVol1.bin / more / code_examples / librar / intcomp.c < prev    next >
Text File  |  1989-02-08  |  896b  |  30 lines

  1. /*--------------------------------------*/
  2. /*                    */
  3. /*            INTCOMP(X,X,X)        */
  4. /*                    */
  5. /* Compares the contents of two integer */
  6. /* arrays. If the arrays are identical, */
  7. /* a zero is returned. If the first ar- */
  8. /* gument is smaller than the second, a */
  9. /* -1 is returned. If the first argument*/
  10. /* is greater than the second, then a 1 */
  11. /* is returned. The third argument is   */
  12. /* the length of the compare.        */
  13. /*                    */
  14. /*--------------------------------------*/
  15. intcomp(a,b,c)
  16. int a[],b[],c;
  17. {
  18.         int j,x;
  19.         x=0;
  20.         for (j=0;j<c;j++){
  21.              if (a[j]!=b[j]){
  22.                  if (a[j]>b[j])
  23.                      x=1;
  24.                  else
  25.                      x=-1;
  26.                  j=c;
  27.              }
  28.         }
  29.         return(x);
  30. }