在一个无序数组中查找具体的某个数字n。
#include <stdio.h>
#include <stdlib.h>
int main(){
int arr[4] = { 9, 5, 2, 7 };
int to_find = 2;
int i = 0;
for (i = 0; i < 4; ++i){
if (arr[i] == to_find){
printf("找到了 !\n");
break;
}
}
if (i == 4){ //当 i 为 4 是,说明数组找完了但没找到指定数字
printf("没找到 !\n");
}
system("pause");
return 0;
}
博客主要讲述在无序数组里查找具体数字n的相关内容,聚焦于信息技术领域中数组查找这一操作。

3464

被折叠的 条评论
为什么被折叠?



