#include <stdio.h>
#include <stdlib.h>
int Find(int a[], int n, int x)
{
for (int i=0; i<n; i++)
{
if (a[i] == x)
return i;
}
return -1;
}
P124.43
本文介绍了一种在整数数组中查找指定元素位置的方法,通过循环遍历数组并比较元素值来实现。
本文介绍了一种在整数数组中查找指定元素位置的方法,通过循环遍历数组并比较元素值来实现。
#include <stdio.h>
#include <stdlib.h>
int Find(int a[], int n, int x)
{
for (int i=0; i<n; i++)
{
if (a[i] == x)
return i;
}
return -1;
}

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