home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a120 / 1.ddi / WATCOM_C / WAT105.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-07  |  672 b   |  27 lines

  1. /*------------------------------------------------------------------*/
  2. /* ╡{ªí└╔ªW║┘: wat105.c                                             */
  3. /*------------------------------------------------------------------*/
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. int compare(int *a, int *b)
  8. {
  9.    return( *a - *b );
  10. }
  11.  
  12. void main()
  13. {
  14.    int mynumber[5] = {135, 27, 14, 234, 65};
  15.    unsigned num = 5;
  16.    int key;
  17.    int *result;
  18.  
  19.    key = 14;
  20.    result = lfind(&key, mynumber, &num,
  21.                sizeof(int), (int(*)(const void *,const void *))compare);
  22.    if (result)
  23.       printf("ºΣ¿∞╝╞ªr %d ñF\n",key);
  24.    else
  25.       printf("ºΣñú¿∞╝╞ªr  %d \n",key);
  26. }
  27.