Thread: Recursion

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    ah ! finally . yes that the point. each call is independant, yet controled.

    Quote Originally Posted by Lionmane
    Also, what does "results = n==0 ? 1" mean?
    http://www.cplusplus.com/doc/tutorial/tut1-3.html
    Conditional operator ( ? ).

    The conditional operator evaluates an expression and returns a different value according to the evaluated expression, depending on whether it is true or false. Its format is:
    condition ? result1 : result2
    if condition is true the expression will return result1, if not it will return result2.

    7==5 ? 4 : 3 returns 3 since 7 is not equal to 5.
    7==5+2 ? 4 : 3 returns 4 since 7 is equal to 5+2.
    5>3 ? a : b returns a, since 5 is greater than 3.
    a>b ? a : b returns the greater one, a or b.
    Last edited by xErath; 06-04-2005 at 12:06 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Template Recursion Pickle
    By SevenThunders in forum C++ Programming
    Replies: 20
    Last Post: 02-05-2009, 09:45 PM
  2. Recursion... why?
    By swgh in forum C++ Programming
    Replies: 4
    Last Post: 06-09-2008, 09:37 AM
  3. a simple recursion question
    By tetra in forum C++ Programming
    Replies: 6
    Last Post: 10-27-2002, 10:56 AM
  4. To Recur(sion) or to Iterate?That is the question
    By jasrajva in forum C Programming
    Replies: 4
    Last Post: 11-07-2001, 09:24 AM
  5. selection sorting using going-down and going-up recursion
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-02-2001, 02:29 PM