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?

7 Years
Discussion Span
Last Post by Fbody

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.

Votes + Comments
Right on.

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

Edited by XodoX: n/a


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".

Edited by Fbody: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.