Go over the array in a auto-indexing for loop and calculate the difference between each element and your target. Keep the resulting element and its index in a shift register. If the difference for the current element is smaller than for the one in the shift register, put the current element in the shift register. When the loop is over, the element in the SR is the one closest to your target.
If the array is sorted you can use a while loop to stop after a certain point. If it's very big you can try sorting it and then using the while loop. You will have to experiment to see if it's faster.
___________________
Try to take over the world!