Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7491857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:11:11+00:00 2026-05-29T16:11:11+00:00

Suppose this is the call stack of my program at a particular point: |

  • 0

Suppose this is the call stack of my program at a particular point:

|    b = 2       |
|    c = 3       | <- function f2
| return address |
| function args  |
|     ...        |
|    c = 10      | <- function f1
|     ...        |

f1() calls f2().

When variable c is referenced, how is it resolved? Is the stack searched linearly top down to find the first variable named c in scope, or is there some other mechanism that takes care of this more efficiently?

If the stack is searched every time, wont it be an overhead when a non existent variable d is referenced, because the stack will be searched all the way to find out that there is no such variable in scope?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:11:12+00:00Added an answer on May 29, 2026 at 4:11 pm

    In C++, during runtime the variables don’t have names. Variable names are only there for the convenience of the programmer. Variables have scope in the code, they don’t have a scope in the stack.

    So the stack is not searched during runtime. During compilation the variable name is converted into a memory address.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I suppose that, from the call stack point view, it's the same to
Please suppose I have a function that accepts a pointer as a parameter. This
Three doubts 1) Suppose I get the call stack as below user32.dll!_InternalCallWinProc@20() + 0x28
Suppose this C# code: using (MemoryStream stream = new MemoryStream()) { StreamWriter normalWriter =
Suppose this is my URL route: (r'^test/?$','hello.life.views.test'), How do I make it so that
I suppose this question could just as easily be applied to PHP with regard
I suppose this question is a variation on a theme , but different. Torrents
I suppose this might be similar to this question , but I'm wondering if
I suppose this could apply to any dynamic language, but the one I'm using
I suppose this is a long shot considering how few Wonderware questions I've seen

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.