-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathExercise 16.4
24 lines (15 loc) · 1.19 KB
/
Exercise 16.4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
1. (Modify) As described in Table 16.1, the new operator returns the address of the first new
storage area allocated or NULL if not enough storage is available. Modify Program 16.7 to check
that a valid address has been returned before a call to populate() is made. Display an appropriate
message if not enough storage is available.
2. (Program) Write a C++ function named modify() that modifies an existing structure in a list
of structures consisting of names and phone numbers. The argument passed to modify()
should be the address of the structure to be modified. The modify() function should display
the existing name and phone number in the selected structure, request a new name and phone
number, and then display the final structure.
3. (Program) Write a function named insert() that inserts a structure in a linked list of structures
consisting of names and phone numbers. The argument passed to insert() should be
the address of the structure preceding the structure to be inserted. The inserted structure
should follow this current structure. The insert() function should create a new structure
dynamically, call the populate() function used in Program 16.7, and adjust all pointer values
accordingly.