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 7516951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:17:43+00:00 2026-05-30T01:17:43+00:00

I understand I did not make myself clear. My doubt, I think, could be

  • 0

I understand I did not make myself clear. My doubt, I think, could be summed up in this:

In an executable file(machine code) how are “variables” represented? Are they static memory addresses? Does the compiler gives each one a specific “name” (or just keeps the one you gave them)?

Expressed in code:

 int x=5;
 //Bunch of code
 cin>>y;
 cout<<x+1;

How does the program in each and every machine knows which address is going to hold the value 5, to hold the inputed value, to add 1 to the value it now holds and finally print that same value.

–João

  • 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-30T01:17:44+00:00Added an answer on May 30, 2026 at 1:17 am

    Here is a simple program in C:

    int main() {
        int a = 5;
        int b = 7;
    
        int c = a + b;
    
        return 0;
    }
    

    If you compile it with gcc -m32 -S -O0 -o main.s main.c under Linux, you’ll get something like this

        .file   "main.c"
        .text
        .globl  main
        .type   main, @function
    main:
    .LFB0:
        /* %ebp is a Base Pointer Register */
        pushl   %ebp
        movl    %esp, %ebp
    
        /* Here we reserve space for our variables */
        subl    $16, %esp
    
        /* a's address is %ebp - 4 */
        movl    $5, -4(%ebp)
    
        /* b's address is %ebp - 8 */
        movl    $7, -8(%ebp)
    
        /* a + b */
        movl    -8(%ebp), %eax
        movl    -4(%ebp), %edx
        addl    %edx, %eax
    
        /* c's address is %ebp - 12 */
        movl    %eax, -12(%ebp)
    
        /* return 0 */
        movl    $0, %eax
        leave
        ret
    

    As you can see, in this case, variables’ addresses are calculated as offsets of a base pointer of a function. If you enable optimisations, variables’ values may be stored in registers.

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

Sidebar

Related Questions

While reading this link, I did not understand the point on avoiding table locks
according to this code i dont understand about NSClassFromString how did i know viewControllerName
First of all I did not write this code. I found it on somebody
I read the documentation, but I did not understand what is the purpose of
I recently inherited an iPhone app. The original developer did not understand memory management
I've encountered some template code that doesn't compile, and I'm not sure I understand
I could not understand why after logging in from address: http://localhost/en/accounts/login/?next=/en/test/ I get refirected
I'm trying to make an array from file path components. I have an array
I'm Such a C++ noob and im trying to understand the code im covering
I'm trying to profile a C++ application, that I did not write, to get

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.