int diff = 32767; // save the lowest difference in this variable. init with maximum int because it's the worst possible match for this data type. don't know if there is a constant for maxint?
int result = 0; // assuming the array contains only one element, the best match would allways be index #0
for (int i = 0; i<sizeof(row); i++) { // loop trough array
if ( abs( row[i] - val ) < diff ) { // if the difference between value at index #i and val is lower than the previously found best match...
result = i; // save the better results index
diff = abs( row[i] - val ); // save the as yet best difference value
}
}

So you have a loop that steps through all the array.
At each one you subtract the array element from the value and use the abs() function to remove any negative sign.
You have a minimumFoundSoFar variable initially set to a very big value. If the result of this subtraction is less than the minimumFoundSoFar variable you transfer the loop index into the result variable.
At the end of the loop the result variable has the index of the closest match.