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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:33:37+00:00 2026-06-14T12:33:37+00:00

I am trying to learn C++ and trying to write a code for a

  • 0

I am trying to learn C++ and trying to write a code for a simple hash table like following structure:

array[0][0] array[0][1] array[0][2]
key 1        value 1      value 2

array[1][0] array[1][1] 
key 2        value 3     

array[2][0] array[2][1] array[2][2]
key 3        value 4      value 5

means Array of Dynamic Arrays. Now, I can’t understand how to define the array like that ?

Any help on this will be grateful.

  • 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-14T12:33:38+00:00Added an answer on June 14, 2026 at 12:33 pm

    If you really did need to create a dynamic array of dynamic arrays you would have to do it using the new keyword for both arrays. For example:

    // an array of int pointers... each points to the start of an array
    int** arrays = new int*[10]; 
    arrays[0] = new int[99]; // populate the first element of the array of arrays
    arrays[1] = new int[47]; // arrays don't have to be the same size.
    

    Of course I highly recommend NOT doing this. You have to then remember to use delete[] on each member of arrays and on arrays itself.

    Really you should use the built in std::vector type for this. It is why it is there (I voted for the other answers!).

    Just as a note, this is not contiguous memory either. Also if you do want the member arrays to be the same size you could allocate their memory in a for loop.

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

Sidebar

Related Questions

I'm trying to learn about stack base overflow and write a simple code to
I am trying to learn how to write more dynamic web sites that use
I'm trying to learn Haskell, so I decided to write a simple program to
I've just started to learn Haskell and I am trying to write a simple
I am trying to learn C++ and trying to write a code for a
Trying to learn Haskell. I am trying to write a simple function to remove
I am trying to write a simple char driver in an attempt to learn
I'm trying to compile the following simple DL library example code from Program-Library-HOWTO with
I am trying to write a simple program about UDP Connections to learn about
I am trying to learn how to write plugins using SIMBL. I got my

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.