So, I have this array and pointer:

char array [6];
char *ptr;

And this list of array [6] addresses and contents:

0x5010 a
0x5011 b
0x5012 F
0x5013 H
0x5014 X
0x5015 Y

I'm looking for the values of the following:

a) &array[0]
b) array[0]
c) *ptr
d) (*ptr)+2
e) (*ptr+3)
f) *(ptr+3)
g) &array[3]
h) *(array+3)

a) should be a?
b) a

I don't know about the rest. How do I do this?

What do you know about pointers?

A variable that stores a memory address....

Here's my problem. The question you've asked looks like a homework assignment, which is intended to test your knowledge of pointers. If all you know about a pointer is that it is "a variable that stores a memory address," and you have a homework assignment that asks the questions that you've posted, it looks to me like there is some material in your textbook or classroom that you should have studied but haven't.

As a general rule, this list does not do people's homework for them. More specifically, if you've really told us all you know about pointers, then you do not know enough to answer these questions, so answering them would be helping you cheat.

Therefore, I would like to suggest that you spend some time studying what you are supposed to be learning about pointers, and try answering the questions again. If you have made a genuine try at it and still have trouble, someone here will be sure to help you. As it is, though, I think you're just hoping that someone else will do your work for you.

commented: Right on. +3

When you don't know it, stop spamming people's threads.

When you don't know it, stop spamming people's threads.

Don't worry: I do know the answers to your questions. I'm just not going to tell you, and this post explains why.

When you don't know it, stop spamming people's threads.

I also know the answers, but there needs to be better demonstration and conversation on your part first.

Another reason similar to arkoenig's.

Here are some hints:
Questions a and b are about the basics of pointers and how they work.

Questions c thru h appear to require that you review some reference code that you were given someplace in the assignment. Without that reference code, you're SOL. They're about "pointer arithmetic".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.