Convert Static Array to Dynamic Array ?

R

raxitsheth

I am using array in my progrm...

is there any tool /tips so that i can convert my program to Dynamic
Array...so that I can Add more Element to Array....

Code is around 4000 line 'C' (not C++) program....
 
N

Netocrat

I am using array in my progrm...

is there any tool /tips so that i can convert my program to Dynamic
Array...so that I can Add more Element to Array....

Code is around 4000 line 'C' (not C++) program....

Check out the FAQ, in particular question 6.16:

http://www.eskimo.com/~scs/C-faq/q6.16.html

Regarding the final option given there (pointers to arrays) the FAQ says
that "at most one dimension may be specified at run time".

That's no longer true with C99, and my money's on this as the best option
in the case of C99. The advantage it has is that the array's storage
layout is exactly the same as that of a static array with the same
dimension sizes, and there is no need to allocate arrays of pointers. So
you save space and you maintain compatibility with existing code that may
for some reason access the array contents in a way other than normal array
indexing.
 
J

Jack Klein

I am using array in my progrm...

is there any tool /tips so that i can convert my program to Dynamic
Array...so that I can Add more Element to Array....

Code is around 4000 line 'C' (not C++) program....

How is the array defined, and how is it accessed?

It may be as simple as replacing the global array definition with a
global definition of a pointer to that type, and allocating memory for
it early on in main(). Then again, it may not be that simple.

You need to provide more information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top