A C function for searching for an item in an array