橘子味的心
标题:数据结构搜索操作

数据结构搜索操作

#include <stdio.h>



void main() {

   int LA[] = {1,3,5,7,8};

   int item = 5, n = 5;

   int i = 0, j = 0;



   printf("The original array elements are :\n");



   for(i = 0; i<n; i++) {

      printf("LA[%d] = %d \n", i, LA[i]);

   }



   while( j < n){

      if( LA[j] == item ) {

         break;

      }



      j = j + 1;

   }



   printf("Found element %d at position %d\n", item, j+1);

}

目录

分类