Alex
New member
- Joined
- Jul 31, 2020
- Messages
- 2
- Programming Experience
- Beginner
Hello! I'll go straight to the point.
I am coming from C++ and currently migrating to C# due to Unity's needs. Therefore, I have a question about arrays:
E. G. : int[] money = new int[10];
Why do we need to use a keyword - "new" and then declare, the size of the array? (i guess). In C++, I understood at first the declaration - e.g. : int ar[10];
In C#, why can't we use the " int[10] " first? Like, int[10] money.
Thanks, appreciate the effort if you take time to answer!
I am coming from C++ and currently migrating to C# due to Unity's needs. Therefore, I have a question about arrays:
E. G. : int[] money = new int[10];
Why do we need to use a keyword - "new" and then declare, the size of the array? (i guess). In C++, I understood at first the declaration - e.g. : int ar[10];
In C#, why can't we use the " int[10] " first? Like, int[10] money.
Thanks, appreciate the effort if you take time to answer!