Skip to main content
0 votes
1 answer
3k 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 ...
Capn Jack's user avatar
  • 1,251
21 votes
6 answers
50k 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 element ...
Sarfaraz Nawaz's user avatar
3 votes
5 answers
32k 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 ...
VansFannel's user avatar
  • 46.1k
45 votes
4 answers
130k 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 ...
Fludlu McBorry's user avatar
1 vote
1 answer
2k 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 ...
ravun's user avatar
  • 1,520
9 votes
7 answers
5k 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 see ...
David's user avatar
  • 307
33 votes
9 answers
230k 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 "...
John Adams's user avatar
  • 4,863
5 votes
4 answers
16k 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?
Agnel Kurian's user avatar
  • 59.8k
1188 votes
27 answers
2.3m views

How can I 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 of the same value. I could swear I once knew a simple way to do this. I could use memset() in my case, ...
Matt's user avatar
  • 88.7k
84 votes
10 answers
151k 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 ...
Nathan Fellman's user avatar
8 votes
6 answers
16k 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 ...
Keith Sirmons's user avatar