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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:02:17+00:00 2026-06-01T02:02:17+00:00

i have a three dimensional bit table array as bit_table[dim1][100][200]; The second and third

  • 0

i have a three dimensional bit table array as

bit_table[dim1][100][200];

The second and third dimensions are always the same.

But dim1 have to grow with time.

when this bit_table is full its size need to grow in the dim1 dimension and the old content needs to be retained

To retain the old content of the table, should i just create a temporary array, copy the old array data to it, and, after the array is expanded, copy back this data? Or is there a better way to do it?

EDIT:

int dim1=10;
unsigned char (*bit_table)[100][200] = (unsigned char)malloc(dim1 * sizeof(*bit_table));
printf("enter new dimension\n");
     scanf(dim1);

….

  • 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-01T02:02:18+00:00Added an answer on June 1, 2026 at 2:02 am

    You could do something like this:

    int (*bit_table)[100][200] = malloc(dim1 * sizeof(*bit_table));
    
    ...
    
    bit_table = realloc(bit_table, dim1_new * sizeof(*bit_table));
    
    ...
    
    free(bit_table);
    

    Obviously, you will need appropriate error-handling for both of these calls. In particular, if realloc fails (in the above code) then you will end up with a memory leak.

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

Sidebar

Related Questions

i have a three dimensional array which i am using as a bit table
i am using visual studio 2010. i have a three dimensional structure array which,
I have the following three arrays and need to create a new two-dimensional array
I have a dataset consisting of a large collection of points in three dimensional
I have three one-dimensional arrays. The task is to store the numbers which exist
I have two vectors defining two separate points in a three-dimensional space. One is
I'm working with a user-defined quantity of bits (I'm holding a three-dimensional array of
I have a 5 dimensional array, where all indicies range from 2-14. It contains
I have a menu being built via a multi-dimensional array. A current item is
Have three classes User, Group and Field. Many to many relationship on User /

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.