How do you use pointers to reference the address of an element in an array?
We just started going over pointers in my C/C++ class, and I'm a bit
confused at how they work. I am presented with this problem:
Assume you have declared a multi-dimensional array char ma[5][30]. What is
the address of the element "ma[0][0]"? Use two (2) different ways to
assign the address to a pointer variable, p. (Do not give a concrete
address for ma[0][0] - this will vary each time the program is run, based
on the memory allocated.)
I know how much this community frowns on providing the "answers" to a
homework problem. I don't need the answer, but hopefully someone can
explain to me how I can use a pointer to get the address of an element in
an array?
No comments:
Post a Comment