I see a lot of video and explanation about 2 dimensional array with double pointer which is possible when you are storing int, but what if I wanna store string in that 2 dimensional dynamical array?
For example, I'm planning to input my files into my 2 dimensional dynamical array which depends on how many accounts or data I have in my files.
Let's say I have 2 now, and in my program I add 1 more account, which is going to be 3, let say each of my arrays only has 3 elements inside, and then besides that, I do not want to set a constant array.
How am I going to set a variable of two dimensional dynamical array that stores the string? like the very simple one.
Edit : And can also someone explain me why do we have to delete after using the dynamical array? like what if I store something? does it mean my elements also get deleted? or when we close the console it will distract the actual memory? I do not really understand.
std::vector<std::string>? You then append as many strings as you want to without having to care for memory management... Technically it is equivalent to a jagged 2d array using raw pointers.int** array = new int*[rows];and thenfor (int i = 0; i < rows; i++){int[i] = new int[cols]};