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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:32:25+00:00 2026-06-03T02:32:25+00:00

So i have a reasonable understanding of pointers but i was asked what the

  • 0

So i have a reasonable understanding of pointers but i was asked what the difference between these are:

void print(int* &pointer)

void print(int* pointer)

I’m still a student myself and im not 100%. Im sorry if this is basic but my googleing skills failed me. Is there anyway you can help me understand this concept a bit better. I haven’t used c++ in a long time, and i am trying to help to tutor a student, and i am trying to solidify my conceptual knowledge for her.

  • 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-03T02:32:27+00:00Added an answer on June 3, 2026 at 2:32 am

    The first passes the pointer by reference, the second by value.

    If you use the first signature, you can modify both the memory the pointer points to, as well as which memory it points to.

    For example:

    void printR(int*& pointer)   //by reference
    {
       *pointer = 5;
       pointer = NULL;
    }
    void printV(int* pointer)    //by value
    {
       *pointer = 3;
       pointer = NULL;
    }
    
    int* x = new int(4);
    int* y = x;
    
    printV(x);
    //the pointer is passed by value
    //the pointer itself cannot be changed
    //the value it points to is changed from 4 to 3
    assert ( *x == 3 );
    assert ( x != NULL );
    
    printR(x);
    //here, we pass it by reference
    //the pointer is changed - now is NULL
    //also the original value is changed, from 3 to 5
    assert ( x == NULL );    // x is now NULL
    assert ( *y = 5 ;)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I seem to have a reasonable understanding of volatiles in general, but there's one
Let's say I have a reasonably good understanding of Hibernate, but want to have
I have inherited a reasonable sized ASP.net solution that has no automated tests. The
I'm reading Understanding Linux Kernel. Paging for 64-bit Architectures As we have seen in
I am liking the http://www.xmos.com chips but want to get a lower level understanding
I am a linux (mostly ubuntu) user with a reasonable understanding of how the
I thought I had a reasonable understanding of the this object in JavaScript. When
Sorry folks but I asked a question earlier and perhaps did not explain myself
I have a really, really poor understanding around security and safety when building websites
I have reasonable experience to manage my own server, so gogrid style management is

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.