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

  • Home
  • SEARCH
  • 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 7835663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:44:06+00:00 2026-06-02T13:44:06+00:00

Does the reference consider as pointer in c++ ? int &x = y; Does

  • 0

Does the reference consider as pointer in c++ ?

int &x = y;

Does x have an space in the memory ?

  • 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-06-02T13:44:08+00:00Added an answer on June 2, 2026 at 1:44 pm

    Implementation-dependent and not specified by the standard. The compiler may treat int &x as if it were a pointer, and make space for it on the stack; it may hang onto it in a CPU register (and thus not need stack space); it may realize that it’s a different name for an existing object and just conflate the two at runtime.

    Here’s a couple of situations as an example of how the compiler might do different things with a reference depending on how it’s used.

    In a function like:

    int foo( int x ) 
    {
       int &y = x;
       y += 2;
       return y + x;
    }
    

    A compiler like MSVC will simply consider y as an alias for x — a different name for the same variable — and quietly replace all mentions of y with x during compilation. Thus the function will actually be compiled as if it were

    int foo( int x ) 
    {
       x += 2;
       return x + x;
    }
    

    But, if you use a reference as a parameter

    int foo( int &x )
    {
       x += 2; 
       return x;
    }
    

    Then x is internally implemented as a pointer and passed into the function on the stack like any other parameter. The compiler treats it as if it were:

    int foo( int *x )
    {
       (*x) += 2; 
       return *x;
    }
    

    The point is that the answer to your question depends on not just which compiler you are using, but also the particular code you’re writing. It’s not specified by the standard in any way.

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

Sidebar

Related Questions

Does anyone have a recommendation for an excellent reference on Microsoft's ReportViewer (VS 2008
What does this mean: Next add reference to: MySql.Data actually I have downloaded mysql
Possible Duplicate: What does it mean to have an undefined reference to a static
I've installed SlimDX but the assembly reference does not come up as a choice
Possible Duplicate: Reference - What does this symbol mean in PHP? What's the difference
This might be a silly question but does ARC (automatic reference counting) interact with
How does one obtain programmatically a reference to the object of which a FieldInfo
Does anyone know of a good online resource which gives a clear reference on
What does the utmscr and/or utmcct values mean in reference to the Http cookie
What is Call Time Pass Reference? What does it do?

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.