Thread: Recursion and local variables

  1. #1
    Banned
    Join Date
    Apr 2015
    Posts
    596

    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
    Join Date
    Dec 2017
    Posts
    1,633
    Obviously, you braindead piece of human garbage.
    A little inaccuracy saves tons of explanation. - H.H. Munro

  3. #3
    Banned
    Join Date
    Apr 2015
    Posts
    596
    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
    39,661
    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
    1,111
    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