#include <stdio.h> int findInArray( double value, int N, double a[N] ) { for (int i = 0; i < N; ++i) { if (a[i] == value) { return i; } } return -1; } int main() { double X[] = {1.2, 3.4, 5.6, 7.8}; double someValue = 3.4; int index = findInArray(someValue, 4, X); printf("Found at position %d, value %lf\n", index, someValue); return 0; }