Home Segments Index Top Previous Next

578: Practice

A destructor is a function that frees memory. Write a destructor, destroy_trade, that reclaims the memory consumed by a trade object, including the memory occupied by the characters associated with the description structure variable. Assume that the destructor's argument is to be a trade object pointer. Revise the program shown in Segment 573 such that it reads data that include information for a description structure variable and such that all instances of free appear only in destroy_trade.