An array is an ordered data structure consisting of a collection of elements (values or variables), each identified by one (single dimensional array or vector) or multiple indexes.

learn more… | top users | synonyms (12)

-9
votes
0answers
39 views

Programming in C. Arrays [on hold]

Write one program that does all of the following: Declare an integer array of size 20 Fill it with random integers in the range 1-100. Print the array in two lines of 10 Find and display the largest ...
1
vote
1answer
7 views

Ruby iterating through a hash and an array

Okay so I'm trying to iterate through an array of strings and replace the words if it matches any of the substitution rules. array= ["I love chicken!", "I love lamb!", "I love beef!"] substitutions = ...
-1
votes
1answer
20 views

arrange index of elements with highest double value in array

So I have an array with 30 probabilities values as double. I want to first check for highest element in array store its index in a new Array repeat the first step by excluding the element that has ...
0
votes
1answer
10 views

I want to find if there is a certain name in the students array and if there is to print out true, and false if there isn't

function createStudent(fn, ln) { //function var person = { firstName: fn, lastName: ln }; return person; } var tim = createStudent("Tim", "Plano"); var matt = ...
-2
votes
1answer
25 views

Styling Javascript Array

How can I style say just pge[1] of the array??? I want to make that whole paragraph a certain color. Is there a way to add an ID or Class to an array value to be styled??? function myPar() { pge = ...
0
votes
0answers
10 views

Output mysql query to array json

How do i go ahead to output mysql row to a var array like this var data = [ {"name" : "mysql data here "username" ", "hvalue" : mysql data here "percent"}, ]; all the possible mysql rows not just ...
-1
votes
0answers
15 views

How to retrieve values of an array, that is passed as an argument to a function? [duplicate]

#include<iostream> #include<random> using namespace std; int *createSquare(); //bool isMagic(int mySquare[]); int *square; bool isMagic(int* mySquare) { int a0 = *mySquare; int ...
0
votes
1answer
11 views

Add column (as first) with 1 to exsiting Variant Array in VBA

I have a array which have 1 or more columns and now I want to add one more column (consists only of 1), but I don't know how do do that. The situation looks like that: My code: Dim X() As Variant X =...
0
votes
2answers
42 views

Javascript find the highest value in 2d array based on array itself

I've a multidimensional array arr = [[[1,1],[2,1],[3,1],[4,2],[5,2],[6,2],[7,3],[8,4]], [[1,1],[2,1],[3,1],[4,3],[5,3],[6,4],[7,4],[8,5],[9,5],[10,5]] ]; and so on ... but the dimension ...
0
votes
0answers
8 views

How can I return an SQLPOINTER Array in C?

I have a simple program that reads data from a Database, I am using ODBC, but I want to save the data or a row in an Array. I have it saved in an SQLPOINTER col[50]. How can I return the entire array? ...
1
vote
1answer
15 views

Array match and return response

I'm really stuck on this thing.. I'm having RESPONSE table with answer and question[array] field and what I'm trying to do is, if I gonna type 'HI' its gonna loop trough all responses array in ...
0
votes
2answers
23 views

PHP - JSON Array - Unsure how to extract data

I have the following JSON/Array from AWS and I'm struggling to read it with PHP: { "Type" : "Notification", "MessageId" : "666483cb-e012-51f2-8d66-d308d55efd98", "TopicArn" : "arn:aws:sns:us-...
1
vote
1answer
20 views

How to import and manipulate strings from files

I'm currently working on a project and am stuck on the next step. I am supposed to make the program read multiple columns of data from a file, each with a separate string array. I have managed to make ...
0
votes
0answers
6 views

Cannot Find Key to Array in BSON object

I am writing a C function to read a bson encoded file. I'm trying to find the key to an array. I know the key exists, because bsondump will print it and the array out. bson_iter_find() returns false ...
1
vote
1answer
20 views

Array access child thread java

I have an array of SinglePDFPage-objects, those are just wrapper objects which each hold a WritableImage-object. While filling it up in a loop inside a child thread, I can still access the array ...
-1
votes
1answer
23 views

Dynamic string array structure in C

I am new to C and I want to create a dynamic array to store strings. I wrote the code below for it but it didn't work. Array elements contain some ASCII chars instead of string. I want historyArray[0] ...
1
vote
0answers
20 views

How is Swift Array.sort() sorting integers faster than tuples if it uses IntroSort algorithm? Is Swift sorting integers differently?

I have been picking and probing at Swift Array's sort function and I was surprised to find that in-place sorting an array of 500,000 integers was remarkably faster than sorting an array of 500,000 ...
-3
votes
0answers
24 views

Array Queue Expand

I have an assignment that is i need to expand a queue implemented as an array.Since an array has a fixed size so i need to create a method so i can expand the array queue. Now i think i created it ...
-2
votes
2answers
23 views

When I add an element to a linked list contained in an array of linked lists why every other element of the list gets deleted?

UPDATED The problem of this code is that after the matrix has been transformed into an array of linked lists, it looks like no value is contained in the array of linked lists. I think the problem is ...
0
votes
2answers
22 views

Count Array values php

I am using laravel, I am getting this error when trying to count the valuse of this array. Error:array_count_values(): Can only count STRING and INTEGER values! the function: public function ...
1
vote
1answer
26 views

how to take average for each portion of an array

Say I have a 500000x1 array called A. I want to divide this array into 1000 equal sections, and then calculate the mean of that section. So I will end up with a 1000x1 array called B, in which B[1] is ...
0
votes
1answer
34 views

Turning digits in an array to an integer. (and more)

Im new to C and trying to build a program thats uses only: arrays, loops, if-else, basic functions (print, scan) !!no strings and such!! :: I should get an equation from user in one line, at the ...
0
votes
1answer
8 views

Should I make an array to store user ids or create new tables?

I'm trying to make an image uploading website and want to create a like system for the images that are uploaded. So should I create an array containing the image id's of all the images liked by a ...
-4
votes
0answers
20 views

how to display text when an item for JList is clicked? [on hold]

I have a list of menu items in a JList and I want to display a description for each item on the right hand side of the application when it is clicked. What is the best approach? image of application
0
votes
0answers
23 views

Does an array function exist which returns first key with a value that satisfies a callback function?

I was scanning through the array functions here and am disappointed with myself for not finding, or PHP (not sure yet) for not having, an array function which does what I currently need. Given an ...
0
votes
0answers
17 views

Filter results in HTML table by multiple filters in multiple filter categories

I am developing an e-commerce website for a mobile phone seller where I receive a few results when searching a product. There is no way to control or filter the receiving results from the server side. ...
3
votes
3answers
58 views

Can't get .Dispose() to work in a foreach loop (RESOLVED)

So I've got this foreach loop here foreach (string file in condensedFilesList) { Image imgToAdd; imgToAdd = Image.FromFile(file); if (imgToAdd.Width < 1920 || imgToAdd.Height < ...
-1
votes
0answers
31 views

Sorting the array in the class

I have the following class and I included only one of it's function (printing) in the code to reduce the question's length. template <class Type> class queueType { public: const queueType<...
-6
votes
0answers
31 views

C# 2d Char Array [on hold]

Need to fill my character array so it just displays "x" in every slot, anybody know how?? Console.WriteLine("Hello, and welcome. What would you like the dimensions for your grid to be? (Must be one ...
0
votes
6answers
28 views

Pushing values inside array using foreach

Here's my input var id = '1,2,3'; var name = 'a,b,c'; var value = 'x,y,z'; How can i construct a array like this [ { "id" : "1", "name" : "a", "value" : "x", } , { "id" : "2", "name" : "b", "value" ...
-3
votes
1answer
23 views

How to sort an Array with Dictionaries which include date?

In my Swiftproject there is an Array with Dictionaries. Each Dictionarycontains a String of date. How can I get a new Arraywith datefrom newest to oldest? Thanks! var array = [["date":"2016-02-12","...
1
vote
0answers
19 views

percentage edit distance from array in perl

I am attempting to get a percentage of an edit distance from a group of sequences in perl. So far this is what I have: #!/usr/bin/perl -w use strict; use Text::Levenshtein qw(distance); my @sequence ...
0
votes
1answer
13 views

Generated integer array based on number in rails

I want to generate 5 buttons with different values based on one integer. For example I've got 30, I want to create buttons with 10 20 30 40 50 value = 30 int1 = value - 20 int2 = value - 10 int3 = ...
0
votes
1answer
10 views

Found nil while unwrapping an Optional value, appending to Array, Swift 3

I'm trying to add a random choice form one Array to another (code below) and am getting the error: "fatal error: unexpectedly found nil while unwrapping an Optional value" let list1 = ["first","...
2
votes
5answers
26 views

Return the maximum number in each array using map

function each(coll, f) { if (Array.isArray(coll)) { for (var i = 0; i < coll.length; i++) { f(coll[i], i); } } else { for (var key in coll) { f(coll[key], key); } }...
-3
votes
1answer
41 views

How can I store an array with information in C++? [on hold]

I'm having trouble understanding how to store information for 5 books: Here is some of the code I am dealing with. How would I store information for one book, for example the following information: ...
1
vote
4answers
36 views

JAVA- Read .txt file with mix of strings & integers, store strings in an array and integers in a 2D array

I have a text file with student's names on one line, followed by 15 grades (each separated by 2 spaces & with a single space at the beginning of the line) on the next line. Example: John, ...
0
votes
0answers
11 views

How to find the winner of a 2-player game (which is an array of integers) using Python 3?

This is a two-player game. The game consists of an array of integers. Each player plays alternatively. The task is to find the largest element of the array and delete the largest element along with ...
0
votes
0answers
9 views

android studio Yahoo Weather API get the forecast

I am following the tutorials of Digital Phanthom, I am trying to get the forecast but i'm not able to get it to work. In his tutorials it doesn't show how to get the Forecast from the JSON file. As ...
0
votes
2answers
44 views

2d array to 1d array C#

I've got two algorithms converting random 2d arrays (m х n or m х m) to 1d array. I'm wondering if there is a way to make them work als in the opposite direction and convert the result to 1d array ...
2
votes
5answers
67 views

Can an array be declared as a constant?

Is it possible to either: Declare an array as a constant OR Use a workaround to declare an array that is protected from adding, deleting or changing elements, and therefore functionally constant ...
-1
votes
0answers
11 views

Saving a custom class in an array to be saved

I'm creating an app that will create a form which a user will then fill out and save for later use. @interface DataModel : NSObject @property (strong, nonatomic) NSString *whiskeyName; @property (...
0
votes
4answers
29 views

How to fill numpy array with another numpy array

I have an empty numpy array, and another one populated with values. I want to fill the empty numpy array with the populated one, x times. So, when x = 3, the (originally empty array) would look like [[...
0
votes
0answers
15 views

I need to do an array of a path

I have a directory with folders and folders in them and after or more folders or files. I can run all those directories and files recursively, but I want to form an array with all that. Let's imagine ...
1
vote
2answers
34 views

Why don't np.where & np.min seem to work right with this array?

The issues So I have an array I imported containing values ranging from ~0.0 to ~0.76. When I started trying to find the min & max values using Numpy, I ran into some strange inconsistencies that ...
-1
votes
0answers
22 views

Get data based on field, which is evaluated on condition

I am facing a complex data filtering scenerio. I have array of objects as below: SrNo:BabyName:ParentName 1:A:X 2:D:X 3:B:Y 4:E:Y 5:C:Z I get input as array of BabyNames and I have to find ...
0
votes
2answers
13 views

How to remove the largest element in the array along with the elements to the right of it in Python 3?

I want to remove the largest element in the array along with the elements to right of it Here is my code: >>> curG = [34,89,11,99,36,92,67] >>> f = curG.index(max(curG)) >>&...
1
vote
3answers
41 views

Nested lists and saving into a text file

I have a nested list containing strings and integers that I'm trying to save into a txt file but I'm having trouble with formatting. array = [(string1, int1),(string2, int2),(string3, int3),...(...
0
votes
1answer
26 views

Swift Extension of Array with Equatable Elements Cannot Call Index(of:)

I am attempting to add an extension to the Array type in Swift limited to Arrays whose elements conform to the equatable protocol. I am attempting to define a function in the following manner: import ...
0
votes
2answers
28 views

Android - JSON - How to create JSON that has X objects and an array inside each one of them

I need to produce a JSON with many objects inside, and each of them to have an array of strings. I'm using Java, more specifically Android. I want to produce something like the following: "manager1":...