1998-02-19から1日間の記事一覧

逐次探索

C

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