Most voted "array" questions
An array (array, vector, or matrix) is an ordered data structure representing a collection of elements (values or variables), each identified by one or multiple indices.
Learn more…3,046 questions
Sort by count of
-
1
votes3
answers424
viewsSort a string array in Swift using a function
I am in need of a help to solve the following programming logic problem on Swift. The task is to arrange the array below downwards using a function. Description: You must implement an algorithm that…
-
1
votes0
answers42
viewsHow to jump to the next two-dimensional array value and print this value
I would like to take the value of the second index of the array " game[0][1]=["1", "15/06", "09:00", "Egypt", I have to jump to the next game (next line) until I find a match that hits on the…
-
1
votes0
answers41
viewsFunction integration returns error "only length-1 arrays can be converted to Python scalars"
I’m trying to integrate a function into a certain range that shows the particle flux in a zero-angle (theta) direction as a function of the E energy of the particles. I’ve tried a lot of different…
-
1
votes1
answer133
viewsHow to know which is the last item selected from a listview?
Hi, I have a ListView using the simple_list_item_multiple_choice, filled with a ArrayString of all Brazilian states. I need to fill the following SQL command with all the states selected by the user…
-
1
votes1
answer275
viewsdynamic reallocation - struct array
I need to do an exercise where the code allocates the memory as needed, but I need to reallocate an array of struct, only I ended up locking in this part. My Struct is: typedef struct{ char…
-
1
votes1
answer38
viewsData return en JSON in an array , uploading the database ID by the respective Names. How can I do this?
I made this code, but it only returns me the ids, and I would like in the place of the ids he did a search by Ner Join in the database and returns in place of the ids the names. Php code: <?php…
-
1
votes1
answer69
viewsDeclare array in class not knowing it will be its size
How to declare an array within a class, even if you don’t know what size it will be and leave it accessible throughout the program. Note this class: class exemplo{ public: int tx{0}; int ty{0}; int…
-
1
votes1
answer38
viewsCompare arrays and highlight changes
I’m having a little problem that I’m having trouble solving. I have an array with a history of occurrences that has 5 positions, and I need to display these histories by highlighting the different…
-
1
votes2
answers567
viewsInsert array into a database using PHP
On the site I’m creating I have a form where people can add various topics. My problem is at the moment where a second or more topics is created because only the first one goes to the bank and I…
-
1
votes0
answers73
viewsI cannot do Array (in JSON) in Typescript
Below is the Array I need: [ { "id":1, "nome":"LESPAUL", "validade":1525568400000, "dataGerada":1525914000000, "status":true, "itens":[ { "cliente":{ "id":1, "login":"gabriel", "senha":"123",…
-
1
votes2
answers29
viewsDifficulty finding values in an array
The following code is an increment code in an array. However, I haven’t been able to select any array value. If so print_r in it, it shows all but if I try to access with $guarda_array[1] he returns…
-
1
votes0
answers78
viewsC Array of Sockets
I am studying in C and I am creating a program that exchanges messages between pc’s in client/server style. Created an array of sockets and threaded them. int main () { pthread_t *servidor =…
-
1
votes3
answers46
viewsChanging position of multiple DIVS with same selector in Jquery
I have a page that contains several structures with the same selector, such as: <div class="preco"> R$ 69,90 </div> <div class="preco-a-vista"> R$ 50,00 </div> As I…
-
1
votes0
answers153
views(c) Sort Struct Matrix
Good to all! I have a little problem that I can’t solve and I seek help from the members. In my code, I read the contents of a file and save in a string for use in the code, in the main loop, I…
-
1
votes3
answers6645
viewsUnion of two vectors in C
I need to perform the union of two vectors, resulting in a third vector: a[5]={1, 2, 3, 4, 5}, b[5]={6, 7, 8, 9, 10}, c[10]; else if (select_menu == 4) { int select_f4, i, j, x; printf("Esta é uma…
-
1
votes0
answers71
viewsProblem with array_search
I have the array down that is giving a problem. When I give a search it only seeks some values it is not finding the 2018-06-11, 2018-06-18 and the 2018-06-26 The rest works perfectly $hoje =…
-
1
votes1
answer228
viewsPick the fields of a Select and pass to viewmodel
Guys I own two Selects Multiple where their function is to change values as shown in the image below: The first in real is a Dropdownlist where he searches the bank’s information, follows its code:…
-
1
votes1
answer2505
viewsChange attribute of an object array in the state in the application
to try to make an attribute of one of the objects in an array of objects switch between true and false follows code: Initial state: constructor(props) { super(props) this.state = { post: [{ nome:…
-
1
votes3
answers791
viewsTake a value of multiple arrays within an array
I have a question regarding an array, I have an array that stores several arrays inside, this is the result: Array ( [0] => Array ( [membro_id] => 1465 [membro_nome] => Gustavo Silva de…
-
1
votes1
answer33
viewsjQuery function for selecting values in Divs and playing for an array
I’m taking the values of several <div>s with the same class name and trying to play for an array in jQuery, but as I’m starting in the language I’m not getting, I’ve already searched the…
-
1
votes1
answer417
viewsTake string size inside array with PHP
I have the following problem, in the program below, I took the forms of a site, but I have to specify the exact length of the line that has the form(96), I would have the possibility to take this…
-
1
votes2
answers12546
viewsHow do I add more elements to an array in php
I’m creating a function to validate form data, and wanted to know how I add errors to array, every new error he add in the array??? <?php // Função criada para validar todo tipo de formularios em…
-
1
votes1
answer161
viewsArray within Array
Good night, I am consuming a webservice and get the data in json with Curl. I have the data stored in the variable $data. What I need is this: Let’s assume that the variable $data has the following…
-
1
votes3
answers95
viewsMore or less a Select in array
Good evening, I have two Arrays: $array1 = ( [0] => Array ("Nome":"Rodrigo","CPF":"123456789-00","Cargo":"Abestado") [1] => Array ("Nome":"Maria","CPF":"987654321-00","Cargo":"Abestada")…
-
1
votes0
answers59
viewsMount object tree
I need to Mount a php object tree, where I have for example: id | parent_id | nome | telefone | email from the past id I search and mount all the tree from that idPai (int) 0 =>…
-
1
votes1
answer861
viewsPassing array as a function parameter
How to pass a array to a function without me having to inform the amount of indexes it has? Stating the size #include "stdafx.h" #include <Windows.h> void imprimir(int _array[], int _tamanho)…
-
1
votes1
answer987
viewsGrab each row of a CSV file
I need to take data from a CSV file and store it in an array. Example: CAIO ; 0909;abacaxi BRUNO;1231;maça I have to take for example row 1, and each value of each column store in a variable to play…
-
1
votes2
answers882
viewsDoubt about filling in Java Array
I’m having trouble solving the following exercise: Create a class with a main method; Create an int array with 10 positions and popule using for; Print all array values and, for even values, display…
-
1
votes2
answers35
viewsGet duplicate values from Vector
I would like to get only the values that are duplicated in the array I’m trying to do it like this: $cdCursos = array(1, 2,3,4,5,3 ); echo "<pre>"; print_r( $cdCursos ); echo "</pre>";…
-
1
votes1
answer53
viewsArray only loads last PHP record with PDO
I’m generating the information, but it only fills the last line of the query executed inside the Array, even though I’m sure it’s running all the lines in the foreach. Does anyone have any idea how…
-
1
votes2
answers83
viewsPopular inputs according to the selected option value
I have three arrays, cities, capitals and population. How can I click on a given state to show in the inputs the respective values, i.e., capital and population of the selected state. var cidades =…
-
1
votes0
answers60
viewsdownload a text separately a text found within a textbox
Picking a given text within another textbox or richtextbox does not matter when there is an incidence of detailed text, e.g.: "text": take out of double quotes when the next sentence is found and…
-
1
votes4
answers1449
viewsUndefined object reference for an object instance in array
I have a problem. I have to make a video rental program in which you say the data of 5 movies, and then the program lists all the information! And it is mandatory to make a class for this! I’ve done…
-
1
votes1
answer14836
viewsHow to calculate the sum of each row of a matrix in C?
I need to create an algorithm that reads the dimensions of a matrix, read the values to be placed in the matrix, with a vector calculate the sum of the values of each row and print the matrix and…
-
1
votes0
answers43
viewsError to popular array, firebase, photo gallery ANDROID STUDIO
I’ve been researching this mistake for three days and I can’t fix it. I’m setting up a photo gallery for my app and need to popular an Array with the photos coming from Firebase to show them in the…
-
1
votes2
answers289
viewsHow to join different foreach results in an array?
I’m picking up information from movie posters from a movie site, using Simple Html Dom. <?php include("simple_html_dom.php"); $html = file_get_html("http://arcoplex.com.br/?lang=059"); To get the…
-
1
votes1
answer93
viewsItem relocation in the array key
Good afternoon! Although I have researched the subject and searched in the documentation, I have not yet been able to come up with a solution to the following problem.. I have an array brought from…
-
1
votes0
answers47
viewsAbsurd performance difference between pygame.surfarray.array3d and array2d
Using the pygame.surfarray to control an image as an array, manipulating any element in an array3d is more than 5 times slower than manipulating an element array2d. See this benchmark: from datetime…
-
1
votes1
answer101
viewsPrint meshing when csv file uploaded is larger or smaller than 9 columns
My application reads a csv file and convert to pdf. For this I have the frontend in html to load the file. I would like to know how to show the user a message stating that the file is invalid. The…
-
1
votes1
answer55
viewsHow to handle this array code with php?
I have a question, how to treat this array: ["*original"]=> array(13) { ["id"]=> int(1) ["user_id"]=> int(3) ["reference"]=> string(36) "c8d2076672c9631e8c048589f3a9a26f3961"…
-
1
votes0
answers46
viewsArray and error handling in numbers game
The game is to discover opponent’s numbers, but not lottery type, have to use reasoning to get to the correct number. The rule is to play with 4 numbers at a time without repeating on the same line.…
-
1
votes2
answers557
viewsKnow if value is in the unparalleled equality array!
I have the following code in C++: #include <iostream> using namespace std; int main (void){ int e[5] = {10,20,30,40,50}; for (int i = 0; i <= 99; i++){ if ( i in e ) cout << e[i] ; }…
-
1
votes4
answers1713
viewsRemoving lines from a numpy array
For example I have array arr1 and I want to take a line range from that array as below, which function I can use? arr1: array([[ 1, 1, 1], [ 2, 2, 2], [ 3, 3, 3], [ 4, 4, 4], [ 5, 5, 5], [ 6, 6, 6],…
-
1
votes0
answers27
views -
1
votes1
answer6449
views -
1
votes1
answer321
viewsStruct vector: Passage by reference in C
This code is from a simple register of people, containing code and name of the person. I am confused about the passage from the struct vector to the "insert procedure". When compiling, the program…
-
1
votes1
answer219
viewsHow to access methods of an object array?
I am doing a work of the college in which I have to develop a banking system, for this I have 3 types of account (1 class for each type), therefore I want to use an array of generic objects. The…
-
1
votes1
answer82
viewsI am trying to print an array using for in javascript, but it is not displayed correctly
I printed it manually and then tried using a for to carry out the printing, but I happen not to be able to display it properly. let mochila = new Array(); let item1 = ['corda', 2], item2 = ['faca',…
-
1
votes0
answers331
viewsDisplay array elements without the key
Hello, I have a small "problem". I am trying to iterate an array session through a foreach, but it always returns only one result. So I used a var_dump() and the result was this: array (size=1) 0…
-
1
votes5
answers459
viewsConcatenate id by description into an array in javascript
I have an array in js with only an id and a description, example: var variavel = [{id: 1, descrição: 'Brasil'}, {id: 2, descrição: 'Brasil'}, {id: 3, descrição: 'Chile'}, {id: 4, descrição:…