M
M
Michael2016-01-06 23:24:32
C++ / C#
Michael, 2016-01-06 23:24:32

How to declare an infinite two-dimensional array of string type?

In general, you need to declare an infinite two-dimensional array and fill it sequentially (that is, how else to find out the number of the last row?)
How can this be done in the most "direct" way?
forms c++/cli project

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
Oleg Tsilyurik, 2016-01-06
@Olej

you need to declare an infinite two-dimensional array and fill it

Cool. ;-)
It would be cooler only: to declare an infinite array of infinite dimension...

V
Vladimir Martyanov, 2016-01-07
@vilgeforce

std::vector, std::list are fine for you.

I
isotoxin, 2016-01-07
@isotoxin

If the array is sparse, i.e. many unfilled positions, then an imitation of an array based on a map is a good idea:
write at an arbitrary position:
read:
std::string s = arr[std::pair<int, int>(1, 3)];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question