Question: 1. Given: int *i = 0; int *p; What is the value of p after the following C++ statements? p = i + 5; 3
1. Given:
int *i = 0; int *p;
What is the value of p after the following C++ statements?
p = i + 5;
3 20 0 5
2. int *i = new int [50];
What element (not index) does *(i + 2) refer to?
3 2 8 6
3. Given:
int *i = &some_integer_variable;
How many bytes would the following C++ statement move the pointer i?
i += 2;
8 4 1 2
4. If the array "somearray" contains the following elements:
Index Value 0 133 1 714 2 333 3 219
What is printed to the screen after the code below executes?
int *i = somearray + 1; int *p = i + 2; cout << *p;
333 133 714 219
5. If the array "somearray" contains the following elements:
Index Value 0 133 1 714 2 333 3 219 What is printed to the screen after the code below executes?
int *i = &somearray[1]; int *p = i + 1; cout << *p;
219 714 333 133
6.Given:
int *i = 74; int *p;
What is printed to the screen after the following C++ statements?
p = i;
if (p == 74) cout << "true"; else cout << "false";
false true
7. Given the following:
int *i = 20; int *p;
What would be the value of p after the following C++ statements?
p = i + 4;
20 24 36 28
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
