CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Threaded View

  1. #7
    Join Date
    May 2009
    Posts
    2,413

    Re: Please help me understand this question.

    Quote Originally Posted by LarryChen View Post
    I got it.
    As I indicated, the recursive function can be simplified and then it becomes even clearer how it works,
    Code:
    void ReadListBackward(node* p) {
       if (!p) {
    	printf("T!\n"); // recursion terminates
       } else {
    	printf("F: %d\n", p->data); // print in forward direction
    	ReadListBackward(p->next); // recursive call
    	printf("B: %d\n", p->data); // print in backward direction
       }
    }
    Last edited by nuzzle; June 4th, 2013 at 01:04 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured