Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Recursion

  1. #1
    New to the CF scene
    Join Date
    Dec 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Recursion

    Been trying to figure out what is a recursive procedure.

    In most programming language, any example, how are recursion use?

    Thanks if anyone can enlighten me on that.

  • #2
    New Coder
    Join Date
    Aug 2002
    Location
    San Francisco
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ah, yes. RECURSION. I had some trouble trying to figure out what the hell that was long ago. It's a pretty simple concept. It just may be hard to think the entire process in your head.

    It's basically a method, or function, calling itself, getting itself into a deeper and deeper stage.

    Here's a simple example of recursion in programming. It might take some time to understand at first, but I'm pretty sure you'll get it.

    int factorial(int n)
    {
    if (n==1)
    return 1;
    else
    return factorial(n-1) * n;
    }
    Mr. H
    Programmer-at-large.
    "Programming is like sex. One mistake and you have to support it for the rest of your life."


  •  

    Posting Permissions

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