1998-06-20から1日間の記事一覧

逐次探索 (番兵)

C

明解C言語 入門編 > 6. 関数 > 逐次探索 (番兵) C #include <stdio.h>#define NINSU 5 #define FAILED -1int search(int ary[], const int key, const int no) { ary[no] = key; int i = 0; while (1) { if (ary[i] == key) break; i++; } return (i == no ? FAILED </stdio.h>…