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
-
2
votes2
answers167
viewsHow do I pass an array of structure pointers to a function?
#include <stdio.h> #include <stdlib.h> #define NUM_NOTAS 5 #define TAM_NOME 20 struct Aluno{ char nome[TAM_NOME]; int numero; int notas[NUM_NOTAS]; }; void preenche(struct Aluno*…
-
2
votes1
answer323
viewsHow to copy an array of struct to an equal one?
I have 2 arrays made of a struct: struct events { string Kind; int Time; int DurVal; int Chan; }; events e1[100] events e2[100]; How can I make a full copy of the array e1 for e2 in a single…
-
2
votes2
answers736
viewsEmpty nRec upon receiving return from SEFAZ
Using the Nfephp project API, through the function: $retorno = $nfe->sefazEnviaLote($aXml, $tpAmb, $idLote, $aResposta, $indSinc, $flagZip); get the array $aResposta. However this array is…
-
2
votes1
answer565
viewsFunction to check that all elements of a variable array are null
Suppose I have one array in which each element of this array is a variable that stores a string within it. Example: error{ [nome] : null; [sobrenome] : "sobrenome inválido"; [estado] : null; } I’d…
-
2
votes1
answer319
viewsHow to fill an entire array with malloc(sizeof(int)) with some value
I have a problem, I have no idea how to fill this vector with some value, for example, I want to fill it all with -1 (start it all with -1). The problem here is that I don’t know exactly how big my…
-
2
votes1
answer200
viewsArray to Arraylist conversion difference with "asList" and constructor
What is the difference between these two ways of converting a array? If there is any difference, the same impact on performance? List<String> list = Arrays.asList(meuArray);…
-
2
votes1
answer47
viewsCreate arrays according to "exploded" strings
I have the following array: Array ( [0] => 1-6 [1] => 1-7 [2] => 2,9 ) I would like to group it according to their initial number. Example result (I’m not sure of this syntax, but it’s just…
-
2
votes2
answers383
viewsSubtraction of arrays
I have two arrays: A AND B A = [1,2,3...] B = [7,5,1...] When I do this subtraction has the correct subtraction return: console.log(A[0] - B[0]); But when I play in the loop it doesn’t work: while…
-
2
votes2
answers517
viewsHow to join two array
need to join two array first array array (size=11) 7100 => boolean false 7108 => boolean false 7110 => boolean false 7120 => boolean false 7130 => boolean false 7140 => boolean…
-
2
votes3
answers161
viewsSize of a character array according to its addressing
Is the size of a character array given by its address or by the value of the variable? Example: char[1000] = "Exemplo Teste" The size of this variable is 1KB due to its addressing char[1000] or her…
-
2
votes2
answers209
viewsWhen triggering an event in an array element (with querySelectAll) trigger only one element of another array (also with querySelectAll)
In the code that follows below, I would like to pass and remove the mouse (mouseover and mouseout) about a li, the change was made only in the item corresponding to that li, in the case, the tags a…
-
2
votes3
answers606
views -
2
votes3
answers196
viewsGrowth ranges of an array’s values
I’d like to know a way to determine growth intervals and decreasing of a vector in C#. Example: Array[0]=0; Array[1]=1; Array[2]=2; Array[3]=3; Array[4]=4; Array[5]=3; Array[6]=2; Array[7]=1;…
-
2
votes1
answer108
viewsProblem to select a specific object within a hash
Hello! Good morning. I have the following situation: In my Ruby code, there is a flower class(attributes: code(generated by a function with auto increment), name, value and category(this at ributo…
-
2
votes2
answers6936
viewsAverage C using vectors
I started my journey on C two days ago. I went to try to develop a function that averaged certain numbers of a vector. The function has some problem since it was to return the value of 4,5 and is…
-
2
votes1
answer65
viewsArrays with keys that vary numerically
In the PHP I’m declaring my variable like this: $id_produto = $dados["id_produto".$input.""]; Where $inc is increment within the loop and the $dados["id_produto".$input.""] should return something…
-
2
votes5
answers3984
viewsHow to compare arrays to javascript?
I have an array that I get from the checkboxes that the user chooses const check_frutas = ["banana", "uva", "pera"]; And in my code, I need to compare this array with others to get the most similar.…
-
2
votes2
answers300
viewsHow to create an array through another?
I have a problem that deals with providing an array to the program and this should return only the odd numbers of this array, and for this I create a new array that receives the values: public void…
-
2
votes1
answer87
viewsValues are being sent nulls
For some reason the arrays are being sent null in setListGrades, but inside the log shows the normal arrays. The API is being consumed correctly, so it is null when sending this method? @Override…
-
2
votes1
answer844
viewsHow to save array to db?
I have 4 fields and wish to save in a db, however when putting in foreach ($_post['name'] as $name)... I do not know how to add more.. **DB** id | vt | nome | qtn | id_cat 1 | 23 | qua..| 58 | 4 2 |…
-
2
votes1
answer864
viewsAccess information in Multidimensional Associative array (PHP)?
I have the following structure: $arrDados = Array ( [0] => Array ( [NumeroEmpenhoNumero] => Array ( [type] => NULL [size] => 0 [deci] => 0 [code] => 0 ) ) [1] => Array (…
-
2
votes1
answer284
viewsSelect ID vectors with certain characteristics in R
I have a data frame with four columns of values for each ID and need to create a new df excluding Ids whose vectors have more than one zero or more than one NA. I created the DF library(dplyr)…
-
2
votes2
answers121
viewsRepeat loop with problem
I have the algorithm below, and on the line while lista[i]==lista[i-1]: is returning the error: index out of range import random n1=0 n2=0 n1=int(input('Insira um numero para inicio'))…
-
2
votes1
answer34
viewsR <- Vector - Error in c(vector_item, v$Qty) : Object 'vector_item' not found
A simple doubt, How to have the (new) vector briefly to avoid: for(v in i$checkout) { c(vector, v$name) -> vector c(vector_item, v$qty) -> vector_item } Error in c(vector_item, v$Qty) : Object…
-
2
votes1
answer353
viewsFirebaselistobservable transforms into Object Array
I am using Ng2-Smart-Table, according to the documentation it accepts an array of objects to mount the table: In HTML: <ng2-smart-table [settings]="settings"…
-
2
votes3
answers157
viewsHow to do explode inside the $request->all() array
I need to go through this array and get all the keys that start with col. Does anyone know how to do this? array:8 [▼ "_token" => "NZ68b8h3L560aUc6DXBeb8Myb4JFD0hSgfSpJ2Lk" "_method" => "PUT"…
-
2
votes2
answers40
viewsSearching and comparing java
I am preparing a program that must request the RA of a student, the RA must be greater than zero. Soon after I want to buy the second RA typed to verify that it has not already been registered. I…
-
2
votes1
answer2788
viewsHow to properly use memcpy?
I’m trying to create a program where it will have two vectors : char vetor_origem[20] = "algoritmo"; char vetor_copia[20] In what can be seen, in the vetor_origem I have the word algorithm written,…
-
2
votes2
answers47
viewsHow to access the data in a variable of type double[ , ] in C#
I’m studying C# and in a certain code I came across the following situation: double[,,] R = new double[_StatesMaxCount, 3, 2]; In all the time I’ve been studying, I’ve never seen this kind of…
-
2
votes1
answer700
viewsPick all dates of a day of the week
I have a code that takes all the dates of a particular day of the week. Ex. 5/06/2017 = Monday. The code is working perfectly. But it is limited only 1 day of the week, I would like to "spend" more…
-
2
votes1
answer400
viewsHow to count the elements of a list
I have a list that stores data: [(pizzas, 'COMIDA'), (1, 'QUANTIDADE'), (chocolate, 'SABOR'), (1, 'QUANTIDADE'), (catupiry, 'SABOR'), (1, 'QUANTIDADE'), (morango, 'SABOR')] I’d like to check what’s…
-
2
votes1
answer2871
viewsGet values from within stdClass array stdClass
I have this class where I can query and return data from an external webservice: $params = array( 'usuario' => $usuario, 'senha' => $senha, 'quantidade' => 2 ); $wsdl =…
-
2
votes1
answer1834
viewsMove arrays using "push" and "pop"
Declare a function called "move", which takes two arrays, removes the last element of the first and adds it to the second. Example: var umArray = [1, 2, 3]; var outroArray = [4, 5]; mover(umArray,…
-
2
votes2
answers9256
viewsCheck if value exists in object array
I have an array which is as follows [ { "Param": 1, "Valor": 68 }, { "Param" 1, "Valor": 79 }, { "Param": 2, "Valor": 165 } ] I would like to know how to verify the number (no Valor) exists in the…
-
2
votes0
answers38
viewsPHP Parse error: syntax error, Unexpected '[' - PHP 5.3.29
I have an application running perfectly locally. But when I played it online I keep getting the following message and I have no data return. PHP Parse error: syntax error, Unexpected '[' in…
-
2
votes2
answers110
viewsDoubt using array
I would like to know why the index is used in the code 0 when a for to identify if the size of the array is smaller than the counter j. public class Aplicacao { public static void main(String[]…
-
2
votes1
answer78
viewshow to define the input array for RNA training in the rnn package?
In the package rnn there is an example of how to proceed to perform network training, which is described in this link (example 1). In the approach of this package the entries are given in the format…
-
2
votes2
answers1516
viewsDeserialize json string array to string array
Hello, I’m having trouble deserializar a Json, I’m not getting the right data. There is the Main Class that would receive the data list public class PermissaoDossie { [JsonProperty(PropertyName =…
-
2
votes1
answer118
viewsTry to create two-dimensional arrays as objects
I’m trying to create a simple program that allows me to create 2d (matrix) matrices with different objects. My thought process was that I should be able to create objects with arguments (as stated…
-
2
votes2
answers914
viewsPut vectors in order. JAVA
I need to put five pesos in order from the smallest to the largest. Defining the numbers instead for example: int vet[] = {3,4,2,8,7,1}; it runs right, but I need to do it this way: int vet[] = new…
-
2
votes1
answer230
viewsSearch in two-dimensional array
Hello, I took some courses to learn how to program and I have learned advpl, I have learned to search arrays using the function aScan, but now my array is two-dimensional, as I will do the search? I…
-
2
votes2
answers737
viewsDoubt about displaying inverted array
Could you explain to me how it works to return an array with inverted values? I took this exercise to do, but I couldn’t. Then a colleague gave me this exercise to dissect him, but I didn’t…
-
2
votes1
answer480
viewsDifference between Dictionaries and Lists/Arrays?
I am trying to understand the concept of each and its differences. I want to understand in which situations to use one or the other.
-
2
votes1
answer2430
viewsConsume Webservice in SOAP with HTTPRIO in DELPHI
I’m having a little trouble with a request via webservice/Soap. I’m trying to feed a function of a WSDL of Vtex through the Delphi and it always returns to me that a value has not been filled in.…
-
2
votes5
answers135
viewsProblems with arrays in a Python password generator
I’m making a generator of passwords and I’m not able to join letters that are separated into one array. from random import choice minusculas = ['a','b','c','d','f','g','h'] maiusculas =…
-
2
votes3
answers8565
viewsCompare 2 arrays and save the difference between them in the database?
I have 2 object arrays, one of them is composed of emails that comes from the provider through IMAP protocol and I convert to objects and then put in an array all of it. The other is an array of…
-
2
votes1
answer39
viewsFilter in the null returning array
I have the following doubt, I am with that const export const STATUS = [{ 0: 'Rascunho', 1: 'Enviado', 2: 'Processando', 9: 'Processado', 3: 'Agendado', 4: 'Protocolizado', 5: 'Suspenso', 6: 'Erro…
-
2
votes1
answer2487
viewsHow to make a method return a string in Java
I want to create a program that reads the name and age of a person and compares the ages and finally shows the name of the older person. My reasoning was to compare which is the highest and return…
-
2
votes2
answers124
viewsDoubt in array method each_with_index
When executing the method below it prints literally 0 x 2, 1 x 4. etc.. I need to find a solution to print only the result of the value product by the index. My current code: array = [2,4,6,8]…
-
2
votes1
answer277
views"rank" array in Python
I’m having a problem and I’m having trouble solving it, the following is I have a list of the kind : ['Words', 4], ['evidenced', 3], ['presented', 2], ['showed', 2], ['second', 1], ['treaties', 1],…