Explain the behavior of the following function. If there are problems in the code, explain what they are and how you might fix them
belongs to book: C++ Primer|Stanley B.Lippman, Josee Lajoie, Barbara E.Moo|5th Edition| Chapter number:6| Question number:24
All Answers
total answers (1)
The function prototype is the same as
`void print(const int *ia)`
, which means we can pass any pointer to int to the function, not only an array of ten`int`
s. This will lead to an error. We can change the parameter to a reference to array: