Question: Find the error in the vector reversal code given below. line 1 : for ( i = 0 ; i < prices.size ( ) ;

Find the error in the vector reversal code given below.
line 1: for (i =0; i < prices.size(); ++i){
line 2: tmp = prices.at(i);
line 3: prices.at(i)= prices.at(prices.size()-1- i);
line 4: prices.at(prices.size()-1- i)= tmp;
Find the error in the vector reversal code given below.
line 1: for (i =0; i < prices.size(); ++i){
line 2: tmp = prices.at(i);
line 3: prices.at(i)= prices.at(prices.size()-1- i);
line 4: prices.at(prices.size()-1- i)= tmp;
line 1
line 2
line 3
line 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!