Top "Array-initialization" questions

Shortcut for creating character array

Since I like to Split() strings, I usually use new char[] { ';' } or something like that for a parameter …

c# array-initialization
How to initialize an array of 2D-arrays?

I have an array of 2D-arrays. For example, it is like: {{{0, 0, 1}, {1, 0, 0}} {{0, 0, 3}, {2, 1, 2}, {2, 2, 1}, {3, 0, 0}} {{0, 0, 7}, {3, 2, 6}, {6, 2, 3}, {6, 3, 2}, {7, 0, 0}}} But If I write int [,][] arrays={{{0, 0, 1}, {1, 0, 0}} {{0, 0, 3}, {2, 1, 2}, {2, 2, 1}, {3, 0, 0}} {{0, 0, 7}, {3, 2, 6}, {6, 2, 3}, {6, 3, 2}, {7, 0, 0}}}; the compiler will …

c# multidimensional-array initialization array-initialization
Array concatenation in C#

How do I smartly initialize an Array with two (or more) other arrays in C#? double[] d1 = new double[5]; double[] …

c# arrays initialization concatenation array-initialization
Zero-Initialize array member in initialization list

I have a class with an array member that I would like to initialize to all zeros. class X { private: …

c++ initialization initialization-list array-initialization
How to fill an array efficiently in Powershell

I want to fill up a dynamic array with the same integer value as fast as possible using Powershell. The …

arrays performance powershell append array-initialization
Java syntax error on tokens, misplaced constructs - array initialization

I have the following code in Java 5: for (Object o : theList) { for (int k=0; k<theList.size(); k++) int[][] …

java arrays syntax-error array-initialization
Why can't you use shorthand array initialization of fields in Java constructors?

Take the following example: private int[] list; public Listing() { // Why can't I do this? list = {4, 5, 6, 7, 8}; // I have to do this: …

java arrays array-initialization
Why the difference between int a[5] = {0} and int a[5]={1} (Missing Feature)

When we initialize an array like this int a[5] = {0}, the compiler makes all 5 elements 0. That is really good, compact-initialization and …

c++ arrays language-design language-features array-initialization