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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:15:49+00:00 2026-05-26T06:15:49+00:00

I know * defines a pointer… does ** define a pointer to a pointer?

  • 0

I know * defines a pointer… does ** define a pointer to a pointer?

If so, why?

Is a pointer to a pointer some times known as a reference? Just need clarification for the following very simple hash.

Generally pointers are used to pass the location of larger structures when passng the entire contents would be too costly.

I’ve seen pointers to pointers used in the quantlib project to create “handles” as each “observer” holds a pointer to a “term structure” pointer that might change at run-time, hence the pointer held the location of another pointer.

However I see no correlation here?

class hash_entry 
{
private:
    int key;
    int value;
public:
    hash_entry(int key, int value) 
    {
        this->key = key;
        this->value = value;
    }
    int getKey() 
    {
        return key;
    }
    int getValue() 
    {
        return value;
    }
};

class hash_map 
{
private:
    hash_entry **table;
    static const int TABLE_SIZE = 128;
public:
    hash_map() 
    {
        table = new hash_entry*[TABLE_SIZE];
        for (int i = 0; i < TABLE_SIZE; i++)
            table[i] = NULL;
    }
    int get(int key) 
    {
        int hash = (key % TABLE_SIZE);
        while (table[hash] != NULL && table[hash]->getKey() != key)
            hash = (hash + 1) % TABLE_SIZE;
        if (table[hash] == NULL)
            return -1;
        else
            return table[hash]->getValue();
    }
    void put(int key, int value) 
    {
        int hash = (key % TABLE_SIZE);
        while (table[hash] != NULL && table[hash]->getKey() != key)
            hash = (hash + 1) % TABLE_SIZE;
        if (table[hash] != NULL)
            delete table[hash];
        table[hash] = new hash_entry(key, value);
    }
    ~hash_map() 
    {
        for (int i = 0; i < TABLE_SIZE; i++)
            if (table[i] != NULL)
                delete table[i];
        delete[] table;
    }
};
  • 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-26T06:15:50+00:00Added an answer on May 26, 2026 at 6:15 am

    Yes, ** defines a pointer to a pointer (because the spec says so). No, I can’t quite imagine anybody calling that a reference.

    As to why they’re using it in this case, they’re writing (very C-like) code to dynamically allocate an array of pointers to X. This code:

     hash_entry **table;
    
     [ ... ]
    
     hash_map() {
        table = new hash_entry*[TABLE_SIZE];
    

    Is roughly equivalent to:

    std::vector<hash_entry *> table(TABLE_SIZE);
    

    (though for the moment, I haven’t split it up as you’d need to for a class member).

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

Sidebar

Related Questions

Does anyone know if it possible to define the equivalent of a java custom
I was just curious to know if it is possible to have a pointer
I was just curious to know if it is possible to have a pointer
Simple question, I just need a pointer in the right direction: I have a
In Android, I have a Path object which I happen to know defines a
I know that #define s, etc. are normally never indented. Why? I'm working in
As I know I can define a new Enum DataFormat at the my project
I would like to know how to define a returntype in a function in
I know that one can define an 'expected' exception in JUnit, doing: @Test(expect=MyException.class) public
I know how to do it for a float: #define kMyConstant 1.0f but how

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.