home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / CH_04 / 245.jpg < prev    next >
Joint Photographic Experts Group Image  |  2013-12-11  |  465KB  |  2550x3300
Labels: book | crt screen | reckoner
OCR: Searching and Sorting Arrays 245 Header files inc] .ude <stdio .h> ay. For ock or Const tant Definiti ions #define ARRAY SIZE nrch. In ed ele- Functi ion Prototy ypes * / int lin search int target, int array[] int n is the PRECOND ITION: target the value C search for array array to search and the number of elements POSTCONDITION: If the array the target array the funct ion returns rst index array where target was found target is not in the array, the value returned es we int main() ber of int intvar, index; 3 45, 89 large int intarray [ARRAY SIZE] 92 }; onstant "What number do you want to rch for? erfor- printf( "sa" &intvar scanf uses lamed index index lin search( intvar, intarray, 11 tion Dr. intf( not in the array. \n" intvar arrays else ray pr ntf the %dth cell of the array \n" intvar, ...