Adding dimensions to arrays during execution?

Hello all!

I am writing a program that uses a two dimensional array for storing thousands of strings. It imports two files (a reference and something to be checked against the reference). The problem is it only can check one file at a time because it is a two dimensional array. My question is can arrays gain more dimensions throught the execution of a program? For example, if I have the following array:

string example[1000][6];

I want to add a dimension in order to have a 3 dimensional array. Is there a function that can do this? I feel like this could be useful in a multitude of programs and there should be a quick and easy function to do that.

Thanks in advance

Edit: Also, I know you can just start off with a 3 dimensional array, but then you may allocate memory that you never use. Even though we don't really have to worry about memory allocation anymore (with 4 GB of ram it almost doesn't matter) I want to make my program as efficient as possible. Also, it gives me (and the people looking at the post in the future) the chance to learn something new!
Last edited on
You would probably be better served using a different base structure, like a deque or a map maybe? What exactly are you trying to accomplish?
Topic archived. No new replies allowed.