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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:03:34+00:00 2026-06-17T07:03:34+00:00

I read different things on the Internet and got confused, because every website says

  • 0

I read different things on the Internet and got confused, because every website says different things.

I read about * referencing operator and & dereferencing operator; or that referencing means making a pointer point to a variable and dereferencing is accessing the value of the variable that the pointer points to. So I got confused.

Can I get a simple but thorough explanation about “referencing and dereferencing”?

  • 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-17T07:03:35+00:00Added an answer on June 17, 2026 at 7:03 am

    Referencing means taking the address of an existing variable (using &) to set a pointer variable.
    In order to be valid, a pointer has to be set to the address of a variable of the same type as the pointer, without the asterisk:

    int  c1;
    int* p1;
    c1 = 5;
    p1 = &c1;
    //p1 references c1
    

    Dereferencing a pointer means using the * operator (asterisk character) to retrieve the value from the memory address that is pointed by the pointer:
    NOTE: The value stored at the address of the pointer must be a value OF THE SAME TYPE as the type of variable the pointer “points” to, but there is no guarantee this is the case unless the pointer was set correctly. The type of variable the pointer points to is the type less the outermost asterisk.

    int n1;
    n1 = *p1;
    

    Invalid dereferencing may or may not cause crashes:

    • Dereferencing an uninitialized pointer can cause a crash
    • Dereferencing with an invalid type cast will have the potential to cause a crash.
    • Dereferencing a pointer to a variable that was dynamically allocated and was subsequently de-allocated can cause a crash
    • Dereferencing a pointer to a variable that has since gone out of scope can also cause a crash.

    Invalid referencing is more likely to cause compiler errors than crashes, but it’s not a good idea to rely on the compiler for this.

    References:

    http://www.codingunit.com/cplusplus-tutorial-pointers-reference-and-dereference-operators

    & is the reference operator and can be read as “address of”.
    * is the dereference operator and can be read as “value pointed by”.
    

    http://www.cplusplus.com/doc/tutorial/pointers/

    & is the reference operator    
    * is the dereference operator
    

    http://en.wikipedia.org/wiki/Dereference_operator

    The dereference operator * is also called the indirection operator.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I read a lot of different things on the Internet about optimizing MySQL. I
I've read many different things about correct memory management for cocoa/objective-c For instance ive
In different sources i've read different things on the topic. For example Wikipedia says:
I have read everywhere so many different things about opening the facebook app from
I have read about the different types of reference. I understand how strong, soft
I've read the official guide about different densities and resolutions, but cannot find how
I need your opinion on this because I have read a lot of different
I tried many different things to access a google Account in order to read
I'm creating an application to do a few different things on a website in
I need to read different values stored in a file one by one. So

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.