I’m currently having a bit of trouble with arrays of structs (specifically, my array is so big that it takes up seven megabytes of memory), and I’m beginning to question whether I really need to declare all the structs at one time and hog the memory like that, rather than increment it proportionally as new structs are needed (the program reads stuff from a file, and I store the data from the file in the structs; but the number of things it needs to read from the file is unpredictable). What alternative can I use so that the program can refer to individual, unique structs, but doesn’t need the exact number of structs in advance?
I’m currently having a bit of trouble with arrays of structs (specifically, my array
Share
Linked lists? Or any other more advanced data structures, depending on your purpose, but in any case some reading seems to be in order 🙂 Or if you’re doing C++, just use std::list.