Thread: Recursion and local variables

  1. #1
    Registered User
    Join Date
    Apr 2015
    Posts
    500

    Recursion and local variables

    hi guys; once I code a program with recursion method ; does the local variables saved or every call has its own local variables although it's the same name but values would be different? to all the called functions.

  2. #2
    Registered User john.c's Avatar
    Join Date
    Dec 2017
    Posts
    593
    Obviously, you braindead piece of human garbage.
    Let him who is not come to logic be plagued with continuous and everlasting filth.
    - John of Salisbury, 1160

  3. #3
    Registered User
    Join Date
    Apr 2015
    Posts
    500
    Quote Originally Posted by john.c View Post
    Obviously, you braindead piece of human garbage.
    can you illustrate about the question? IDK why you take it not serious

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,036
    Sorry RyanC, you've burned your 500 post allowance.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    600
    Quote Originally Posted by RyanC View Post
    hi guys; once I code a program with recursion method ; does the local variables saved or every call has its own local variables although it's the same name but values would be different? to all the called functions.
    Automatic local variables are unique for every call to a function, through recursion or not.

    For static local variables, each call to the function, through recursion or not, would access the same single instance of the static local.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 12-02-2009, 08:47 AM
  2. Local vs Global Variables
    By BENCHMARKMAN in forum C++ Programming
    Replies: 5
    Last Post: 07-03-2007, 05:17 AM
  3. Globla and local variables
    By ssharish2005 in forum C Programming
    Replies: 8
    Last Post: 11-19-2006, 05:56 AM
  4. local variables
    By Gil22 in forum C++ Programming
    Replies: 14
    Last Post: 04-09-2003, 09:13 PM
  5. local variables
    By Unregistered in forum C Programming
    Replies: 14
    Last Post: 03-20-2002, 02:55 PM

Tags for this Thread