Chapter 10: Problem 20
Under what circumstances can you successfully return a pointer from a function?
/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none}
Learning Materials
Features
Discover
Chapter 10: Problem 20
Under what circumstances can you successfully return a pointer from a function?
All the tools & learning materials you need for study success - in one app.
Get started for free
When a program is finished with a chunk of dynamically allocated memory, it should free it with the __________operator.
Assuming that ptr is a pointer to an int, what happens when you add 4 to it?
Write a function void switchEnds (int *array, int size); that is passed the address of the beginning of an array and the size of the array. The function swaps the values in the first and last entries of the array.
Suppose that you are a manager of a programming team. To facilitate project development and maintenance, you have decided to establish some programming and coding guidelines. Make a list of pointer-related programming guidelines you think will improve program readability and decrease pointer-related bugs.
What is the difference between a pointer to a constant and a constant pointer?
What do you think about this solution?
We value your feedback to improve our textbook solutions.