• fill() assigns newValue to each element in the range [beg,end). • fill_n() assigns newValue to the first num elements in the range starting with beg. If num is negative, fill_n() does nothing (specified only since C++11). • The caller must ensure that the destination range is big enough or that insert iterators are used. • Since C++11, fill_n() returns the position after the last modified element (beg+num) orbeg if num is negative (before C++11, fill_n() had return type void). • Complexity: linear (numElems, num, or0 assignments). The following program demonstrates the use of fill() and fill_n():