s.insert() method return void so why isn’t there any error in this code?
STL quiz -1 , Q 13
Hey @deep4013 please share the question here to, in which you have doubt . As i don’t have questions in order.
i guess you want to ask about insert() function in the set data structure. Set::insert() return a pair, with its members pair::first set to an iterator pointing to either the newly inserted element or to the equivalent element already in the set. The pair::second element in the pair is set to true if a new element was inserted or false if an equivalent element already existed. So in this case answer will be 0 as 10 already exist in set.