This is one of my hw question and I can't find the answer from the textbook.

Question: A function that modifies an array by pointer arithmetic (e.g., ++ptr) to process every value should have a parameter that is?

a) a nonconstant pointer to nonconstant data
b) a nonconstant pointer to constant data
c) a constant pointer to nonconstant data
d) a constant pointer to constant data

My guess is either a or d but i'm not sure...any help plz!!

The clues in the question are modify data and ++ptr. Both these need non-constants. So the only possible answer is a).

Be a part of the DaniWeb community

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