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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:17:57+00:00 2026-05-21T05:17:57+00:00

A couple of days ago I asked myself which data-structure I should in a

  • 0

A couple of days ago I asked myself which data-structure I should in a function in C.
I usually write in C++ and the choice would have fallen to std::vector.

There a some possible choices:

  • a static (big enough) array
  • a dynamic array which grows when needed(e.g. doubling its size)
  • an own list implementation as struct with a pointer next

The last option seems to be unusual. Are there any bigger project where
someone uses own structures like lists?
Is there a general rule for the decision between array or own
data-structures?

When I would need a tree structure I wouldn’t think twice an just write a tree.
Are there any widely used libs with such structures(like boost for C++)?
Or is this considered as bad style because you would have to store a void* instead of
the actual type?

Thank a lot for your experience!

  • 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-21T05:17:58+00:00Added an answer on May 21, 2026 at 5:17 am

    Each has its own advantages and disadvantages.

    • Static arrays: perfect for lookup tables and data that doesn’t change its size throughout the program execution. They get allocated on program startup, so you don’t have to manage this memory in any way. A disadvantage is that you cannot resize or free a static array – it stays there until the program terminates.

    • Dynamically growing arrays: an easy to manage data structure that can almost be a substitute for vector arrays in C++. A disadvantage is the overhead of allocating memory at runtime, but that can be alleviated if you allocate bigger chunks at once.

    • Linked lists: take care if you are going to have a lot of elements because allocating each one separately without using a memory pool can lead to memory waste and fragmentation.

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

Sidebar

Related Questions

I've asked a question here couple days ago, about how to avoid a function
I have started with data nucleus a couple of days ago. I have downloaded
A couple of days ago I asked for help with the floodfill function and
So i asked a couple of days ago Here as to which charts one
I asked a question a couple days ago about creating INSERTs by running a
I took a Computer Graphics exam a couple of days ago which had extra
I have started developing for Adroid Phones a couple of days ago and I
A couple of days ago I asked a question about how to replace and
I asked a couple days ago some clarifications on inheritance , a concept I
I asked this a couple of days ago on Server Fault but am getting

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.