Data Structures, Algorithms, & Applications in C++
Chapter 1, Exercise 3

The code for the function fill is given below and in the file fill.cpp.


template <class T>
void fill(T* a, int start, int end, const T& value)
{// Set a[start:end-1].
   for (int i = start; i < end; i++)
      a[i] = value;
}