Hey guys! I've just taken a quiz about pointers and got a few questions wrong. The quiz is already graded so I can't change the answers but I would I'm trying to figure out what I did wrong.
1. Suppose nums is an array of 100 doubles (where a double is a 64 bit floating point number) and that nums has base address 1000000.
What is the output?
1 2 3 4 5
for (int i = 0; i < 100; i++)
nums[i] = i*100000;
cout << (int) &nums[5];
2. Note: For the following question, you should enter your answer as a whole without any commas.
If numbers is an array of type double with base address 789,108, then
&*(numbers + 361) has the value...?
3. Suppose p is a pointer of type int at address 1000000 and that p has value 1000020. What is &*(p + 4) ?
(Enter your answer without commas.)
4. What is the output?
1 2 3 4 5 6 7
int nums[] = {2,4,6,8,10};
int* a = &nums[1];
int m = *a++;
cout << m*++*a << endl;
#include <iostream>
usingnamespace std;
int m = 5;
int f(int * p, int * q) {
*p += *q;
return m-- + *q++;
}
int main() {
int k = 8;
int r = f(&m,&k);
cout << r + m*k;
return 0;
}