CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Posts
    21

    question about holding a value in recursion

    Hi all,
    I have and insert function that calls a bool recursive function. In the recursive function I call a split function. I need something to happen if the split function was called at any time in the recursive function so that i could use it in an if statement in the insert function. For example,
    *this isn't exact code or anything just an example*
    insert
    {
    calls bool pushDown
    if(split happened)
    do something
    }


    pushDown
    {
    if(blah blah)
    .....return false
    else
    ....//result is bool
    result = pushDown()
    bunch of if's and elses
    split()
    }

    I don't think that cleared anything up much, but i just need proof that spit happened so that in insert i can use that to do something else. Any clue?

  2. #2
    Join Date
    Apr 2003
    Posts
    1,755

    Smile

    You can add global variable to serve as flag if spit happens.

    Hope this will help you.

  3. #3
    Join Date
    Feb 2003
    Posts
    21
    YES! thank you I don't know why I didn't think of that! THANKS

  4. #4
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    Originally posted by SGSpecialK
    YES! thank you I don't know why I didn't think of that! THANKS

    eww globals...stop right there...try a static var and return code.
    Last edited by Mick; April 26th, 2003 at 03:58 PM.

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