array-initialization

C/C++: Array size at run time w/o dynamic allocation is allowed?

I've been using C++ for a few years, and today I don't know if this is a mere brainfart or what, but how can this be perfectly legal: int main(int argc, char **argv) { size_t size; cin >> size; int array[size]; for(size_t i = 0; i < size; i++) { array[i] = i; cout << i << endl; } return 0; } ...

Is it good practice to initialize array in C/C++?

I recently encountered a case where I need to compare two files (golden and expected) for verification of test results and even though the data written to both the files were same, the files does not match. On further investigation, I found that there is a structure which contains some integers and a char array of 64 bytes, and not all...

Array Concatenation in C#

1- How to smartly initialize an Array with 2 (or more) other arrays in C#? double[] d1=new double[5]; double[] d2=new double[3]; double[] dTotal=new double[8];// I need this to be {d1 then d2} 2- Another question: How to concatenate C# arrays efficiently? Thanks ...

How to create table (array) with extern values?

I would like to create a static (file scope) table of data pointer, data size and data version. The problem is that the data are in external files, but constants in the extern files. Example: file1.c const unsigned char data1[] = { 0x65, 0xF0, 0xA8, 0x5F, 0x5F, 0x5F, 0x5F, 0x31, 0x32, 0x2E, 0x31, 0xF1, 0x63, 0x4...

Array initializing in Scala

I'm new to Scala ,just started learning it today.I would like to know how to initialize an array in scala. Example Java code String[] arr={"Hello","World"}; What is the equivalent of the above code in Scala ? ...