arrays

Are array of pointers to different types possible in c++?

Are array of pointers to different types possible in c++? with example please) ...

Extremely large Boolean list in Python

I want to create an object in python that is a collection of around 200,000,000 true/false values. So that I can most effectively change or recall any given true/false value, so that I can quickly determine if any given number, like 123,456,000 is true or false or change its value. Is the best way to do this a list? or an array? or a cl...

Byte Array to Image File

I am given a byte[] array in Java which contains the bytes for an image, and I need to output it into an image. How would I go about doing this? Much thanks ...

High performance comparison of signed int arrays (using Intel IPP library)

We're trying to compare two equally sized native arrays of signed int values using inequality operations, <, <=, > and >=, in a high performance way. As many values are compared, the true/false results would be sotred in a char array of the same size of the input, where 0x00 means false and 0xff means true. To accomplish this, we're usi...

Declaring char[][512]?

I have an C++ SDK that requires a char[][512] as a parameter. I know that this is supposed to be a list of file names and the number of files could vary. For the life of me I cannot figure out how to declare this. I have an array of CStrings and I am trying to copy them over using strcpy_s and then pass them into the SDK. Any idea on how...

How do I build a 2d matrix using STDIN in Perl?

How do I build a 2d matrix using STDIN? If I input a matrix like so: 1 2 3 4 5 6 7 5 6 7 8 9 4 5 6 3 3 3 how do I input this and create two matrices out of this? Here's my code so far while (defined ($a=<STDIN>)) { chomp ($a); push @a,($a); } This is just for the input. My understanding is I can just add each row...

Simple C array declaration / assignment question

In higher level languages I would be able something similar to this example in C and it would be fine. However, when I compile this C example it complains bitterly. How can I assign new arrays to the array I declared? int values[3]; if(1) values = {1,2,3}; printf("%i", values[0]); Thanks. ...

Longest string in numpy object_ array

I'm using a numpy object_ array to store variable length strings, e.g. a = np.array(['hello','world','!'],dtype=np.object_) Is there an easy way to find the length of the longest string in the array without looping over all elements? ...

Initialize int[][,] in C#

How I do Initialize this: public const int[][,] Map = ... I would like to do something like this: public const int[][,] Map = { { // Map 1 {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, {1, 1, 1, 1}, }, { // Map 2 {1, 1, 1, 1}, {1, 0, 0, 1}, {1, 0, 0, 1}, {1, 1, 1...

PHP - How to parse this xml?

I'm trying to parse the XML below so that I wind up with an array that looks like the sample included... I'm having a hard time figuring out how to get the attributes inside of the tags to output the way I want it to... The XML <cust rid="999999" memberid="12345" lname="Doe" fname="John"> <address memberid="12345" address1="1234 M...

Visual Studio Debugger can't view arrays after they have been passed to functions.

I have a function like this: MyFunction(double matrix[4][4]) {/*do stuff*/} I am calling this from an outer function (the otuer function is a member function of a class, in case that matters): OuterFunction() { double[4][4] x; initialize(x); //this function puts the data I want in the matrix MyFunction(x); } I am trying to debug th...

Does the ReDim statement intialise String Arrays with empty strings?

Given the following statements in VBA: Assume that val = 4 and Option Base 0 Dim dataStr() As String ReDim dataStr(val) Will the ReDim statement intialise the String array dataStr to 5 empty string elements(0 to 4). What exactly will be the contents of the Array after the execution of the ReDim statement. ...

Add strings to array PHP

Hello I have $string1, Array[] and $string2. I want to create a Arraynew[] such that Arraynew[0]=$string1 Arraynew[1]=Array[0] . . . Arraynew[n-1]=Array[n] Arraynew[n]=$string2 The problem being that I don't know how many elements are in Array[] since it's from parsed data that changes and also I don't know how to formulate the above ...

Inserting php array data into mysql isn't working

Hello I have an array $name[] that I am trying to insert into the second field of my table but it's not working (table remains completely blank). I cannot find the error in my code what am I doing wrong? $username="us"; $password="pw"; $database="db"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "err...

loop through an array and find partial string

if i have array array[0] = "jack"; array[1] = "jill"; array[2] = "lisa"; array[2] = "jackie"; and i want to find all elements with "ack" in it. in this case it would return "jack", "jackie". what is the fastest way of doing this? ...

How can I build a 2D matrix from standard input in Perl?

Okay, I've been struggling with this all weekend, and I've gotten plenty of help but I'm still not getting it. Here is my code so far: what I want to do is build a few matrices from user input. Eventually I want to multiply them. Another story. input is as follows 1 2 2 4 4 5 6 6 1 2 2 3 1 2 2 3 sub makeMatrix { my ($input) = @...

What is paging effect in C++?

I came across this as I was trying to learn array and vectors in c++. What is the "paging effect" mentioned in the post? Also, just to check my own understanding, I think vector uses more time is because of the dynamic memory allocation. Am I right? additional question: but with vector<int> arr( 10000 ) isn't there already enough memo...

Android - configure Spinner to use array

I declare my Spinner in the following manner (it's very static so I have 2 string arrays in array.xml for titles and values) <Spinner android:id="@+id/searchCriteria" android:entries="@array/ searchBy" android:entryValues="@array/searchByValues"> </Spinner> I expect spinner.getSelectedItem() to return an array [title, value] but in fa...

C++ Array size x86 and for x64

Simple question, I'm writting a program that needs to open huge image files (8kx8k) but I'm a little bit confused on how to initialize the huge arrays to hold the images in c++. I been trying something like this: long long SIZE = 8092*8092; ///8096*8096 double* array; array = (double*) malloc(sizeof(double) * SIZE); if (array == NU...

How do I Merge two Arrays in VBA?

Given Dim arr1 As Variant Dim arr2 As Variant Dim arr3 As Variant arr1 = Array("A", 1, "B", 2) arr2 = Array("C", 3, "D", 4) What kind of operations can I do on arr1 and arr2 and store result in arr3 such that: arr3 = ("A", "C", 1, 3, "B", "D", 2, 4) ...