Is posible somehow add new index to exist array ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is posible somehow add new index to exist array ?

I would like to have an array. For example: int[] arr = new int[1];. Use it in loops, and add new index [n+1]. It's simillar like List<int> li = new List<int>();. Li.Add(x). I know I can use Lists, but array are simpler. Is there any option to use array as List ?

20th Dec 2019, 1:40 AM
Filip Dobeš
1 Answer
+ 4
Regular arrays are static as I understand it, as you said in your question, a List is the preferred option when you need a dynamic container, not a regular array : )
20th Dec 2019, 3:30 AM
Ipang