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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:33:52+00:00 2026-06-09T03:33:52+00:00

What of the below is wrong please? It is my understanding that a pointer

  • 0

What of the below is wrong please?

It is my understanding that a pointer represents an address of something of some type.

So, int i = 18, a pointer to it is int *pI = &i;

The following 2 declarations are valid

void foo (int &something) // Will accept an address of something
void bar (int *something) // Will accept a pointer to something

When we declare a function as

void bar (int *something)

We better send a pointer to something. Indeed, foo(pI) works.

Following the same logic, when looking at

void foo (int &something)

We should send it an address of something pointing to an int as an argument, so then:

Why is foo(&i) wrong?

  • 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-09T03:33:53+00:00Added an answer on June 9, 2026 at 3:33 am

    void foo (int &something) // Will accept an address of something

    This is incorrect: int& is a reference, a concept that is similar to pointers in certain ways, but not at all identical.

    References are similar to pointers in that a value can be changed through a reference, just like it can be changed through a pointer. However, there is no such thing as “null reference”, while NULL pointers are very common.

    When you call a function that takes a reference, you simply pass the variable the reference to which you are taking – no & operator is required:

    void foo (something); // "something" must be a variable
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried the below, and it seems that 'test' results in wrong value. 2500*2500*2500
I wonder if there is something wrong with the copy constructor function below? class
Below is my code,please point out what am i doin wrong?? java I am
Could anyone please corret me with what I'm doing wrong on scenario below? I've
Below is trigger that I need to create but It is not getting created.Please
Whats wrong in below JSON Object definition I am trying to create a new
What am i doing wrong in the below regular expression matching >>> import re
I am getting below exception in runtime, could anybody suggest what is wrong? Microsoft
When I put the below function into leon repl , I get java.lang.IllegalArgumentException: Wrong
I'm trying to figure out what's wrong with my mysqli code below. The data

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.