Home > Software design >  Variable size Array in Java or C#
Variable size Array in Java or C#

Time:07-12

I'm trying to be able to alter the size of an array based on a variable. I was thinking I might maybe later make it a 2D array. I don't want to use arraylist.

int i = 4;
int[] arr = new int[i];

How do you get something like this to work? It gives me error CS0236.

CodePudding user response:

You have to make the int static

  • Related