Question: Question 4 What is wrong in the following code? vector v; ( mathrm { v } [ 0 ] = 2 . 5

Question 4
What is wrong in the following code?
vector v;
\(\mathrm{v}[0]=2.5\);
The program has a compile error because there are no elements in the vector.
The program has a runtime error because there are no elements in the vector.
The program has a runtime error because you cannot assign a double value to v[0].
The program has a compile error because you cannot assign a double value to \(\mathrm{v}[0]\).
Question 4 What is wrong in the following code?

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 Programming Questions!