You could avoid n checks similar to how loop unrolling does it
static int linear(const int *array, int arraySize, int key)
{
  //assuming the actual size of the array is always 1 less than arraySize
  array[arraySize] = key; 
  int i = 0;
  for (; ; ++i)
  {
     if (array[i] == key) return i;
  }
}