|
From: Alan T. <ala...@3n...> - 2001-01-10 03:04:48
|
How do you dynamically allocate space for an array? I have a
program that works but is awkward in one aspect and potentially slow (for
large input files). It performs operations on a file containing a
particular format of calendar entries. Because I did not wish to initially
deal with dynamically allocating memory as I read in calendar entries, I
first read through the file just cueing on an end of entry character, to
count the number of entries. Then I declare an array of the appropriate
size, which will be used to hold processed information for each entry.
This works fine for current input file sizes, but could slow
things down noticeably if the input file was an order of magnitude larger.
So, the alternative would be to allocate space as I read in entries.
Thanks, Alan
|