Chapter 9: Problem 28
Look at the following function definition. void getNumber(int &n) { cout << "Enter a number: "; cin >> n; } In this function, the parameter n is a reference variable. Rewrite the function so that n is a pointer.
Chapter 9: Problem 28
Look at the following function definition. void getNumber(int &n) { cout << "Enter a number: "; cin >> n; } In this function, the parameter n is a reference variable. Rewrite the function so that n is a pointer.
All the tools & learning materials you need for study success - in one app.
Get started for freeWrite the definition of ptr, a constant pointer to an int.
Assume that tempNumbers is a pointer that points to a dynamically allocated array. Write code that releases the memory used by the array.
T F When the indirection operator is used with a pointer variable, you are actually working with the value the pointer is pointing to.
T F The new operator dynamically allocates memory.
When a program is finished with a chunk of dynamically allocated memory, it should free it with the __________ operator.
What do you think about this solution?
We value your feedback to improve our textbook solutions.