Home Segments Index Top Previous Next

518: Practice

In Segment 285, you learned that you are said to practice defensive programming when you add tests to ensure that expected actions actually happen. Add such a defensive-programming test to the program in Segment 514. To do this, you need to know that malloc returns the null pointer, NULL, if it fails to find a memory chunk of the size requested by your program.