Pointer arithmetic is defeating me!

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;


5. What is the output?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>

using namespace 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;

}


Thanks for any help you guys can provide!
> I would I'm trying to figure out what I did wrong.
You didn't answer any of them.
I did answer them, these are the ones that I got wrong.
Topic archived. No new replies allowed.