SOURCE FILE: writeString.cpp
typedef struct node* ptrType;
struct node
{ char Item;
ptrType Next;
}; // end struct
void WriteString(ptrType StringPtr)
// ---------------------------------------------------------
// Writes a string.
// Precondition: The string is represented as a linked list
// to which the pointer StringPtr points.
// Postcondition: The string is displayed. The linked list
// and StringPtr are unchanged.
// ---------------------------------------------------------
{
if (StringPtr != NULL)
{ // write the first character
cout << StringPtr->Item;
// write the string minus its first character
WriteString(StringPtr->Next);
} // end if
} // end WriteString