+ 2

Is it possible to make an array of infinite size?

7th Dec 2017, 1:44 PM
S O U ✌️ I K
S O U ✌️ I K - avatar
7 Réponses
+ 4
Theoretically speaking, of course not. In order to do that you would have to be able to somehow define infinite, and somehow fit it in to your memory. But it's possible to have an array which will adapt to the size it's suppose to hold, by dynamically increasing it when it's prompted of a new allocation.
7th Dec 2017, 2:43 PM
eRosz
eRosz - avatar
+ 3
You are not able to do it with the Array object in C#, but you can resort to its close cousin, List. I wrote you a small example of its syntax and how to generally implement it. Although, you can refer to Microsofts documents on it. https://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx https://code.sololearn.com/c2Tn7EDs9PQK/#cs
7th Dec 2017, 3:56 PM
eRosz
eRosz - avatar
+ 3
thanx cubi*
7th Dec 2017, 5:30 PM
S O U ✌️ I K
S O U ✌️ I K - avatar
+ 3
can we do similar program in c++
8th Dec 2017, 9:35 AM
S O U ✌️ I K
S O U ✌️ I K - avatar
+ 3
Sure, in C++ we're going to be using the Vector object instead. I once again wrote you an example of its syntax and implementation, and I kept the same idea as with the C# example. I'll refer you to cplusplus.com site also, for future reference. http://www.cplusplus.com/reference/vector/vector/ https://code.sololearn.com/cIz3Gcap6Yyl/#cpp
8th Dec 2017, 10:46 AM
eRosz
eRosz - avatar
+ 3
thanks again
8th Dec 2017, 3:46 PM
S O U ✌️ I K
S O U ✌️ I K - avatar
+ 2
how can I do that plz help me
7th Dec 2017, 3:12 PM
S O U ✌️ I K
S O U ✌️ I K - avatar