The array-initialize tag has no usage guidance.
0
votes
1answer
52 views
C# reset an array to its initialized values?
Lets say I have an array of employee wages in the order of average, max, and min:
int[] wages = {0, 0, Int32.MaxValue};
The above code is initalized so that as Im finding the max I can do a ...
13
votes
6answers
26k views
Array initialization with default constructor
public class Sample
{
static int count = 0;
public int abc;
public Sample()
{
abc = ++Sample.count;
}
}
I want to create an array of above class, and want each ...
1
vote
5answers
16k views
Set size on char array in Java
I'm developing an Android application.
I want to set size to a char array like this:
public char[5] language;
But it doesn't work. I have to delete number five to make it work.
I want to limit to ...
14
votes
3answers
55k views
How to initialize two-dimensional arrays in Fortran
In C you can easily initialize an array using the curly braces syntax, if I remember correctly:
int* a = new int[] { 1, 2, 3, 4 };
How can you do the same in Fortran for two-dimensional arrays when ...
1
vote
1answer
1k views
Ada initializing an array based on user input
I'm coming from Java/C++ to Ada and am having trouble figuring out the small stuff. Is it possible to declare an array and ask the user for the min/max values then initialize it? I don't like having ...
7
votes
7answers
3k views
How do you initialise a const array of TGUID from Interface type data, in Delphi?
I want to initialise an array like this -
Const MyArray : Array[0..0] Of TGUID = (IInterface);
But it results in -
[DCC Error] Test.pas(10): E2010 Incompatible types: 'TGUID' and 'string'
So to ...
16
votes
9answers
110k views
How to set array length in c# dynamically
I am still new to C# and I've been struggling with various issues on arrays. I've got an array of metadata objects (name value pairs) and I would like to know how to create only the number of "...
2
votes
4answers
12k views
C#: PointF() Array Initializer
I need to hard code an array of points in my C# program. The C-style initializer did not work.
PointF[] points = new PointF{
/* what goes here? */
};
How is it done?
620
votes
17answers
1.2m views
How to initialize all members of an array to the same value
I have a large array in C (not C++ if that makes a difference). I want to initialize all members to the same value. I could swear I once knew a simple way to do this. I could use memset() in my case, ...
61
votes
10answers
100k views
initialize a const array in a class initializer in C++
I have the following class in C++:
class a {
const int b[2];
// other stuff follows
// and here's the constructor
a(void);
}
The question is, how do I initialize b in the ...
8
votes
6answers
14k views
How do you initialize a 2 dimensional array when you do not know the size
I have a two dimensional array that I need to load data into. I know the width of the data (22 values) but I do not know the height (estimated around 4000 records, but variable).
I have it declared ...