#include #include const int MAXNAME = 20; // maximum no. of characters in a name const int MAXTEL = 16; // maximum no. of characters in a telephone number struct TeleType { char name[MAXNAME]; char phoneNo[MAXTEL]; TeleType *nextaddr; }; void display(TeleType *); // function prototype int main() { TeleType t1 = {"Acme, Sam","(555) 898-2392"}; TeleType t2 = {"Dolan, Edith","(555) 682-3104"}; TeleType t3 = {"Lanfrank, John","(555) 718-4581"}; TeleType *first; // create a pointer to a structure first = &t1; // store t1's address in first t1.nextaddr = &t2; // store t2's address in t1.nextaddr t2.nextaddr = &t3; // store t3's address in t2.nextaddr t3.nextaddr = NULL; // store the NULL address in t3.nextaddr display(first); // send the address of the first structure return 0; } void display(TeleType *contents) // contents is a pointer to a structure { // of type TeleType while (contents != NULL) // display till end of linked list { cout << '\n' << setiosflags(ios::left) << setw(30) << contents->name << setw(20) << contents->phoneNo ; contents = contents->nextaddr; // get next address } cout << endl; return; }