Solution
void RevPrint ( NodeType* listPtr )
// Pre: listPtr points to an element of a list.
// Post: all elements of list pointed to by listPtr
// have been printed out in reverse order.
{
if ( listPtr != NULL ) // general case
{
RevPrint ( listPtr-> next ) ; //process the rest
std::cout << listPtr->info << std::endl ;
// print this element
}
// Base case : if the list is empty, do nothing
}
|