/*----------------------------------------------------------------*/
/* This file can be saved to your machine (almost) as you see it */
/* by doing a "Save As..." from the File menu of your browser. */
/* */
/* For this to work, you must TYPE a filename with .txt as the */
/* file extent. (Simply selecting .txt as the file type */
/* doesn't seem to be sufficient.) Remove the .txt extension */
/* once the file is saved. (IE inserts the page title as the */
/* first line, which must be removed also.) */
/*----------------------------------------------------------------*/
// Return location of item in list[0..n-1] if found,
// Otherwise return n
int
find(char
item, char
list[], int
n) {
int
index;
for
(index=0; index<n; index++) {
if
(list[index] == item) {
break
;
}
}
return
index; // either we found it or we didn't,
// but in either case the value of
// 'index' at this point is the answer
}