Question: 1. For each of the lines below, indicate whether they would result in an error if CONST_VECTOR is a vector as declared above. Briefly
1. For each of the lines below, indicate whether they would result in an error if CONST_VECTOR is a vector as declared above. Briefly justify your answer. (a) (3 points) CONST_VECTOR.push_back (10); 11 (b) (3 points) cout < < "Size afterwards: < < CONST_VECTOR.size() < < endl; 2. (4 points) Write code that invokes function f below, with variable x as its argument. Your answer should appear after the last close curly brace. namespace ns1 { namespace ns2 int x = 7; { } void f(int); } 3. (5 points) Describe what would be printed by the code below or what error would occur. const char* cstr = "0123456"; const char* ptr = &cstr [4]; cout < < ptr [-1] < < ptr < < endl; 1
Step by Step Solution
There are 3 Steps involved in it
Answer 4 points Write code that invokes function f below with variable x as its argument Your answer ... View full answer
Get step-by-step solutions from verified subject matter experts
