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
-
3
votes2
answers65
viewsPrint an Array in <li> line by line with javascript
I need to place the array values inside a list (li), line by line, but the result received brings values in single line. let x = [ { y: 'Título 1', z: ['1' , '2'] } ]; html = ''; for(let i of x){…
-
3
votes1
answer353
viewsHow to fill in selected input only
I have a problem filling a field within a table that is within a loop For, and one of the titles of this table is a button modal, that as it is clicked opens a selection of units of measure. And to…
-
3
votes1
answer141
viewsJavascript - Continuity of an array using arithmetic operations to find the index
In Javascript, I, using in this case the for loop common iteration of array with the variable i, I am trying to create an arrangement with sub-arrangements that have data from other arrangements…
-
3
votes2
answers1922
viewsAccess indices of an array inside another array
I have the array below and need to create a foreachs to go through it and pick up the product and the Qtd. $array = array( array( 'loja' => 'Loja1', array( array( 'produto' => 'bolsa', 'qtd'…
-
3
votes1
answer148
viewsSet the array pointer within a function
I am trying to write a function that assigns an integer or a list of integers to a pointer, depending on a parameter. But the assignment doesn’t work within it, just outside: void retorna_algo(int…
-
3
votes1
answer355
viewsParsing columns of numbers from a CSV file in C
Hello, Good Night I am with a file . CSV simple, containing only two columns, separated by comma and by the new line, as an example: 0.001,-9.623 0.098,2.540 1.000,-1.002 And I need to separate them…
-
3
votes2
answers1128
viewsFind value within an array
I have the following array: array (size=80) 0 => array (size=2) ‘cod_produto' => int 107 'valor' => float 20 1 => array (size=2) ‘cod_produto' => int 109 'valor' => float 375.8 2…
-
3
votes1
answer89
viewsArray bug when passing size 4
I’m asking a question that asks the following: So I made this algorithm: #include <stdio.h> #include <stdlib.h> int main() { int i, j, x=0; int vetor[x]; printf ("Digite o tamanho do…
-
3
votes2
answers101
views -
3
votes1
answer37
viewsI cannot print, in the main function, values from a vector created in another function received by a double pointer
The following source code is the miniaturization of a larger problem I’ve been working on for two days that I can’t solve the problem. I need to print the values of the vector generated by the…
-
3
votes1
answer1651
viewsStore positives in one vector and negatives in another
Make an algorithm that reads a set of 30 integer numerical values and distributes them between two vectors, separating the positive numbers from the negative ones. Vectors must have 30 positions…
-
3
votes1
answer75
viewsVector problem with dynamic allocation
The intention of this program that I am doing is to serve as if it were a banking system in which the amount of accounts to be created does not have a previously defined amount. In the main(), i…
-
3
votes1
answer202
viewsWp_query, How to sort the meta_query in the order of an array?
I’m developing a system where I have a Deck presentation. I have a field that picks up the post by the suit of the type copas being within the array specification meta_value, and would like it to be…
-
3
votes2
answers679
viewsWhat determines a variable as a Python array?
I’m studying about lines in Python and I’m using the object deque module Collections. So, in Python I can access the values of an array by simply writing: array = [1, 2, 3] arra[0] # 1 However, the…
-
3
votes2
answers520
viewsHow to find all '>' characters of a memo and store in an array using Delphi?
I have a field edit in the Delphi and need to travel it in search of the character > and store the position of all characters > in a vector. By doing this I can only get the position of the…
-
3
votes2
answers51
viewsSave data from a Row to an array
I’m developing a new functionality for a project Winforms in C#. Soon I developed the following method that returns itself in the component GridControl (gvDados) there is a line selected or not.…
-
3
votes2
answers252
viewsHow to separate data from arrays into lines?
I ask for one more help: I have a two-dimensional array, and I wanted to separate it into rows in a column, for example: Time 1 Jogador 1 Jogador 2 ... Time 2 Jogador 7 Jogador 8 ... I got to the…
-
3
votes3
answers236
viewsCheck if array contains specific character
I need to check if an array has a specific character (this: | ). If it does, that character should be deleted and the next word that would be after that character (which is actually an item…
-
3
votes2
answers288
viewsHow to create a message sequence in Javascript?
I have an application made in Node, Express and Socket.oi in which alerts are sent to a certain screen that receives the message through the socket.io, on this screen I receive the message, format…
-
3
votes1
answer703
viewsNodejs - Problem sending a POST with object array
I’m using Nodejs + Mongodb, and I’m trying to send an array of Book, via method POST, but somehow it’s giving problem, because when using Postman and clicking Send, it just returns me: { "_id":…
-
3
votes1
answer135
viewsHow to go through an array at each click on C#?
I’m trying to make a Image Viewer for multi page Tiffs. I’m wearing a PictureBox and two buttons - one to move down and to the next page, and one to move up and to the previous page. My code goes…
-
3
votes2
answers110
viewsPick dynamic variable
I am making a script so that when client click on one of the colors that the product has. the product next to change the photo. However, as it is a precise photo array that each id contains a…
-
3
votes3
answers100
viewsProblems with array manipulation to find result
I was solving a problem that was basically: A prisoner was sentenced to perform a job where he was to break all the stones that were provided to him, but he could not use any tool for it. To…
-
3
votes1
answer120
viewsSearch for array containing string and number
Hello, I have an array with the following extrusion ddd: [ 'SP', 11, 12, 13, 14, 15, 16, 17, 18, 19, 'RJ', 21, 22, 24, 'ES', 27, 28, 'MG', 31, 32, 33, 34, 35, 37, 38, 'PR', 41, 42, 43, 44, 45, 46,…
-
3
votes1
answer111
viewsHow to allocate in contiguous memory a structure that contains 1 vector with user defined size?
I was wondering how to answer this issue and I came to the conclusion that I would need a data structure with: the size of a set a previously reported size vector It would be something like the…
-
3
votes2
answers124
viewsHow to know how many times an object appeared in the array
I would like to know how to return the amount of times each object appeared in an array, for example: Entree: array1 = [ {nome: joao}, {nome: maria}, {nome: joao}, {nome: carlos}, {nome: joao},…
-
3
votes1
answer116
viewsHow to transform an array recursively?
I have the following array: let exemplo = [{ alarm: { title: "Pai", id: "1" }, children: [], parent: "", }, { alarm: { title: "Filho", id: "2", }, parent: "Pai", children: [], }, { alarm: { title:…
-
3
votes1
answer563
viewsProgram to generate games and numbers of the mega sena
Unfortunately I’m not managing to generate more than a set of 6 numbers. The correct one would be to generate the amount of games that the user would type and would be stored in the variable jogos.…
-
3
votes1
answer585
viewsJoin two arrays in one with PHP
I have the following PHP: <?php $itens1= array("fruta1"=>"laranja", "fruta2"=>"morango"); $itens2= array("fruta3"=>"goiaba", "fruta4"=>"uva"); array_push($itens1, $itens2); echo…
-
3
votes1
answer61
viewsDo vectors and structures always have continuous addresses?
Why vectors and structures are continuous in memory? I believe that it is not just coincidence. #include <stdio.h> int main(void){ char s[10]; for (int i=0; i<10; i++) printf("%d=%p.\n", i,…
-
3
votes3
answers964
viewsCalculate change and display available notes with Javascript
I have a class activity to do, where I must receive from the user the amount of the purchase and the amount paid, and then display the change. So far ok, only it also asks to display in a textarea…
-
3
votes1
answer56
viewsArray insertion organized in Array for later use as variable
In a Javascript file, I have the following array group: logo: [ require('@/assets/images/logos/lojas-' + cobrand[0] + '.png'), require('@/assets/images/logos/lojas-' + cobrand[1] + '.png'),…
-
3
votes3
answers4717
viewsI need to write a suit functionDeruco, that given a suit, returns a list of strings, one for each card of this suit following the cards of the truco
TIP: The cards include all numbers except cards 8 and 9. The reasoning I had at first was to create several arrays each with the suit name (spades, clubs, diamonds and hearts) and then use the FOR…
-
3
votes2
answers408
viewsHow to identify if a number has been entered in the vector
Write a program that asks the user to enter 6 numbers of a lottery ticket in a vector and later check if there is the number 25 in this sequence of numbers passed by the user. I have a question, I…
-
3
votes2
answers95
viewsHow do I set contacts for a Phone object?
In class Pessoa declared a array of the kind Telefone which stores 3 phone contacts in the set referred to below it for each contact assigns a type and a number. I have a problem where I want to…
-
3
votes1
answer158
viewsFind differences between arrays, with probability of variation
Good afternoon guys, I’m reading about the numpy library setdiff1d function (https://docs.scipy.org/doc/numpy/reference/generated/numpy.setdiff1d.html). It basically serves to express the different…
-
3
votes1
answer114
viewsHow to format an array for JSON output?
I have the following array: const products = ["camisa-PP", "camisa-M", "camisa-G", "camisa-GG", "camisa-GG", "camiseta-PP", "camiseta-G", "cueca-M", "blusa-XG", "blusa-XG", "blusa-XG", "blusa-P"];…
-
3
votes1
answer119
viewsProblem using map with async and await in Javascript
I have a code block where an array type variable is defined and within a function map, I push some values to that array. Inside the map, I can print the array with the filled objects. However,…
-
3
votes1
answer58
viewsHow to get all possibilities from an incomplete string
I have a string, for example, with 5 characters but I need the same to have 10 characters in total, I did the following code to try to get the 5 characters remaining to get a total of 10 characters:…
-
3
votes2
answers84
viewsFilter object array from a Javascript search string
I have an array of objects where sometimes a property can come null. I need to apply a filter to this array to capture objects that have the field and functionality that are passed by a string in a…
-
3
votes2
answers107
viewsUsing do/while in Javascript to request 10 numbers from the user
My teacher passed an exercise with the following description: Make a Javascript program that asks for 10 integers and displays how many numbers are greater than 50 - use loop do while. I couldn’t…
-
3
votes1
answer74
viewsAre "Empty" values within an array not eternal?
In this code snippet: let arr = []; arr[3] = null; The following excerpt arr[3] = null; makes the array size according to the value within the array annotation []. The forEach will be used to work…
-
3
votes2
answers116
viewsHow to get the only different value inside an array in Javascript?
I saw many questions showing how to get unique values in an array, but none solved my problem. I get an array like this: [ 1, 1, 1, 2, 1, 1 ] I want to determine the unique value within it, which,…
-
3
votes3
answers40
viewsHow to turn a 2D Array into 2D Pointer in C
It is possible for a function to receive as a parameter a reference to the address of a two-dimensional array (matrix) static, and from the pointer to access the elements of this matrix. In the…
-
2
votes3
answers1664
viewsHow to use a Cookie as an Array in Javascript?
Doubt: I would like to know a way to use a Cookie, as if it were a Array. Problem: I can’t imagine how to do that. Example: Suppose I have one Array called Foo which would be as follows: var Foo =…
-
2
votes2
answers200
viewsFor loop does not start with Array
I’m new to AS3, and I’m trying to create a game for a course I’m doing, but I’m having trouble starting a loop that should test the collision between two objects called by AS3. Because objects are…
-
2
votes1
answer240
viewsjavascript array communicating in php
I need to create a array in javascript send your information to a page php. How can I do that? Next, I had a pg in php that carried a lot of data from the bank. So to improve her performance, I…
-
2
votes1
answer209
viewsScroll down a level in the array
I have an array as follows: Array ( [Fatura] => Array ( [id] => 821 [numero] => 5014 [vencimento] => 22122014 [emissao] => 22122013 [cliente_id] => 123 [Itens] => Array (…
-
2
votes1
answer473
viewsExtract data from a javascript array
I have an array, and in its contents it has a serialized value. I would like to separate these values and place each value in another array (with properly separated indexes). Follow my code: data =…
-
2
votes1
answer335
viewsHow to make a Sorting in classes?
Funny thing is, that was an answer! The problem I have is this: I have a Person class, which initializes with a string, and it splits into a number and another string. After the class is mounted, I…