Need some help with arrays.

I am working on an inventory system at this point, and i am having some trouble with arrays i want to define an array like this

int[] inventory = {int item1 = 0};

How can i do something like that?

Any help is greatly appreciated.

You define arrays like this:

int[] inventory = new int[] {1,5,94,4}; //directly putting in values
int[] inventory = new int[] {new int(1), new int(5), new int(94), new int(4)}; Same as above, but longer syntax.
int[] inventory = new int[4];//only sets the Length of the array (4), but the values of all elements will be their default vbalues (0 for int, null for GameObject, etc.).

elements of an array don’t have variable names, they are just “there” and get accessed not by their name as a normal varialbe would, but rather by using the index of the element inside the array, for example

int item4 = inventory[4];

Bear in mind that indexing starts at 0, not 1. So, if you have an array with a Length of 4 (4 elements), then you would reference them with [0] to [3].

Also check out Choosing the right collection type