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
answers53
viewsHow can I exchange elements of a string using the values of an object as argument?
I have this code: const operators = { plus : '+', minus : '-', multiplied : '*', divided : '/' } let question = 'What is 4 plus 6?'; let matchs = question.match(/\d|plus|minus|multiplied|divided/g);…
-
2
votes3
answers105
viewsHow to access item in Arraylist
I created a ArrayList for a purchasing system each object is a Item(product), which has the nome, quantidade and preço. However I am willing to make the sum of all prices of all objects that are…
-
2
votes1
answer42
viewsARRAY DATABASE
Personal created a form where I will put the quantity of products and send to the database, except that when I click to send is not saved only saved from one to one, someone could help me I’m trying…
-
2
votes1
answer47
viewsSingle React "key" problem
I am trying to create a chess game using React. I am doing very well except for this mistake. This is my code: import "./style.css"; function App() { const squares = []; //squares order for (var…
-
2
votes1
answer145
viewsHow to transform an array with strings(list) into an integer array in Python?
I’m new to python programming. I came across today the challenge of picking up a vector (ex:V1== ['MESA 11 22 33 44 ']) in which all its elements are in string format (as if they were one, only…
-
2
votes2
answers138
viewsLargest and smallest value of each row of the two-dimensional array
I’m trying to get the lowest and highest value of each line in a two-dimensional array with java, but I’m getting the incorrect values. Follows the code: int[][] arrayValues = { { 21, 33, 70, 16,…
-
2
votes1
answer63
viewsHow can I extract multiple objects from within an Array
I got a problem, I got a problem Array that returns me another Array with this group of objects inside: let array = [ {description: "Auto", amount: 15000, date: "17/02/2021"}, {description: "Auto…
-
2
votes1
answer60
viewsHow can I perform a function only once in a period of time
I wanted to know how to do a single execution, example: In my application there is a way to schedule charges and they are scheduled per day, then on a certain day X she will be charged. I’m…
-
2
votes1
answer102
viewsMemory allocation for string array with malloc()
This code below asks for a num for the amount of strings I want to store in vetor which in this case is the pointer char *strings[num]. #include <stdlib.h> #include <stdio.h> int main()…
-
2
votes1
answer56
viewsI have trouble printing the output of a string array
Code: #include <stdio.h> #include <string.h> int main() { int i, j, k; char nomes[10][99]; for (j = 0; j < 2; j++) { printf("\nTurma %d:\n", j+1); for (i = 0; i < 10; i++) {…
-
2
votes1
answer60
viewsWhat use is memoryview in Python?
I am reading about arrays in Python and came across a function built in call memoryview. I understood that a difference from lists to arrays is that in the latter it is possible to use the…
-
2
votes4
answers350
viewsHow to add values from a dictionary with arrays by the Python key?
I have the following dictionary: { 'tvmv': [121, 250, 48, 45, 54, 120, 115, 138, 60, 30, 274], 'avic': [358, 60, 40], 'hotels_resorts': [60, 31, 45, 50, 300, 165, 40, 46], 'avani': [70, 40],…
-
2
votes2
answers82
viewsSort two lists based on the order of the first
Let me give you an example because it’s clearer to explain: x = [7,5,9,4,2,3,8,1,10] y = ['sete', 'cinco', 'nove', 'quatro', 'dois', 'tres', 'oito', 'um', 'seis', 'dez'] I need to sort the list x,…
-
2
votes1
answer45
viewsInteraction with multidimensional array in php
I have that data: $answers = [ 'text-1626173297126' => [ 'Capítulo teste', 'Juarez Neri Antônio Pereira', 'CAVALEIROS DA LUZ' ], 'text-1626173306001' => [ 'Pedro Ds', 'RenGraminhani', 'CAR…
-
1
votes3
answers23004
viewsHow to pass a struct vector by reference parameter?
My question is, what is the error of this passage? It seems that the passage (*dadosCliente+i) is incorrect, someone knows why? struct cliente{ char nome[50]; char endereco[50]; } void…
-
1
votes2
answers452
viewsHow to make the return of a query (PDO) bring me an array already?
I have that I have : Periodo | Cliente _________________________ jan2014 | Cliente A jan2014 | Cliente B The one I want : array( 'jan2014' => array( 0 => 'Cliente A', 1 => 'Cliente B', ) )…
-
1
votes2
answers233
viewsOutofmemoryerror: Java heap space
I have the following code: class Main { public static void main(String[] args) { Lista chamar = new Lista(); String[] vetor = {"Palavra", "Letra"}; chamar.adicionar(vetor); } } class Lista {…
-
1
votes1
answer122
viewsError adding new instances in a Javascript array
I’m having the following problem I have an array that adds the instance of an auxiliary object to the instance of an Htmlelement, but only the last element is being added, tested in the Chrome…
-
1
votes1
answer20770
viewsCreate Object Array in java and access objects directly
So I need to do the following I have a class with some attributes and methods, I need to generate a array of objects of this class, however I wanted to be able to access them directly, currently…
-
1
votes2
answers1628
viewsHow to add Indice to an array
I am creating an Array in Javascript in the following format: series = [{ name: 'Tokyo', data: [7.0, 6.9, 9.5] }, { name: 'New York', data: [-0.2, 0.8, 5.7] }] But in some cases, I have to add new…
-
1
votes1
answer107
viewsHow do I use addObject within an Array?
I have a Nsmutablearray *arrayFavoritos In the log I can see { name1 = 6; name2 = "Paolo Rossi\nIt\U00e1lia"; name3 = "cartaz-1982.jpg"; photo = "copa8.jpg"; name4 = 24; }, { name1 = 6; name2 =…
-
1
votes1
answer1195
viewsCodeigniter: retrieve values from the out-of-loop array
I’m having a problem storing the array values in the code below: public function get_submenu() { $query = $this->db->get_where('categories', array('category_id_parent' => 0)); foreach…
-
1
votes3
answers1981
viewsRescue the index of an object with a certain attribute within an object array
I have the following in javascript: var listaImagens =…
-
1
votes1
answer148
viewsKeep object alive in memory for another class
Hello! I have a very simple doubt, because I have already found a solution for it, but it still seems problematic. I will explain: I created a connection with web service to receive some data, and…
-
1
votes1
answer375
viewsHelp: Valuing a char vector of a struct within an if
I’m trying to define the value of a char vector of a struct within an if, but without success... The struct itself: struct ficha { char nome[31], classificacao[31], telefone[21]; float altura, peso,…
-
1
votes2
answers1483
viewsHow should I subtract arrays
array_intersect_ukey($result1, $result2, 'key_compare_func2') // primeiro array array_intersect_ukey($result2, $result1, 'key_compare_func2') // segundo array Upshot: Array ( [bife] => 3 ) Array…
-
1
votes3
answers21786
viewsArray inside array... using push arrays
For study purposes and better understanding I am trying to make an array within another array by adding values using the push array_follow my example: <?php $ar1 = array(); array_push($ar1, 1, 2,…
-
1
votes1
answer131
viewsArray is not as array
I have the following code <?php while($data = $QuerySearch->fetch(PDO::FETCH_ASSOC)){ $js[] = $data; } $r = array(); $arr = array(); foreach($js as $k=>$v){ foreach($v as $col=>$c){…
-
1
votes2
answers202
viewsChange class vector size
I have to use vector public static String vetor[] = new String [15]; in the class... but this class is used in a Servlet. And the size I need the vector is what the user chooses... how can I pass…
-
1
votes1
answer935
viewsJoin two Arraylist
I made a ArrayList (nomeTimes) which receives a number of team names as per the for down below: for(int i = 0; i<numeroTimes;i++){ String nomeTime=entrada.next(); nomeTimes.add(nomeTime); } My…
-
1
votes1
answer114
viewsRestrict a character limit array in the LIKE
I have a question about the LIKE of T-SQL. Is it possible to restrict by a number of equal characters to check how many addresses start equal and can end different? Sort of like this: Where Endereco…
-
1
votes2
answers1298
viewsRemove array from an array
I have the following data in an array var array = [ ["755", "20", "E", "274", $$hashKey: "0AK"], ["756", "20", "E", "274", $$hashKey: "0B7"], ["455", "30", "E", "159", $$hashKey: "0BQ"], ["757",…
-
1
votes1
answer92
viewsComparable with Arrays.Sort
I’m having difficulties using the interface Comparable. In class TrabalhoGA I must call the method ordenaPorPontos class temporada2013 comparing the points of Pilotos of this class, I need to use…
-
1
votes1
answer287
viewsHow to retrieve the click on an array of buttons
I’m making a minefield, so I have to add an array of buttons to a panel (to be the houses). I created the button array and added each[x][y] button in a panel. But I don’t know how to retrieve the…
-
1
votes2
answers474
viewsConvert an entire number from the database into an Array
I want to convert an entire number from the BD into an Array, for example: I have the number of deliveries registered in the BD, let’s assume that the 'x' production is completed in 5 deliveries.…
-
1
votes2
answers2335
viewsPHP with HTML - Place an array inside a select html
Hello, I am beginner and I have the following question, I have an array, where one of the parameters comes from the bank, where the number 5 is, comes from the bank. $inicio = 1; $ultimo = 5; //esse…
-
1
votes1
answer209
viewsConcatenate parts of variable names
I have a cycle for, and I want to create several arrays with the name different from the increment of the for. I try that, but it’s not possible. for($y=0; $y<=1; $y++){ $newarray_date.$y =…
-
1
votes1
answer1240
viewsMounting array with checkbox
I would like to mature the idea below to send a variable in Javascript to Asp and with the choices in array, I’m only managing to send a choice at the moment: <!DOCTYPE html> <html>…
-
1
votes3
answers799
viewsDelete Item Array
I’m trying to remove an item from a array corresponding to [NUMERO] but not working. Array: Array ( [0] => Array ( [NUMERO] => 123 [DATA] => 11/11/1111 [VALOR] => 2,22 [ARQUIVO] => )…
-
1
votes1
answer255
viewsDirectly manipulate $_GET and $_POST variables
I have an application that will work with a large amount of data to be manipulated and stored in a database, so it is indicated to store the values present in variables $_GET and $_POST in…
-
1
votes1
answer640
viewsPass array of a checkbox as parameter
I am developing in PHP a basic system, and on the home screen I am listing all registered users. For each user, I have a checkbox that receives the value of the user code. I would like you to check…
-
1
votes1
answer65
viewsResize Multidimensional/Associative Array from a Resultset
I’m trying to feed a array multidimensional and associative from a Resultset, but accuses the following error: Microsoft VBScript compilation error '800a0401' Expected end of statement…
-
1
votes1
answer205
viewsTransform javax.persistence.Query to Arraylist
It is possible to transform a javax.persistence.Query in ArrayList. I need to return an object of the type Query but it cannot have all the values of the result. I want to eliminate some results…
-
1
votes2
answers178
viewsPicking up items with array prefixes
I own a array thus: array('one' => 1, 'two' => 2, 'three' => 3, 'my_one' => 55, 'my_two' => 33). But I’d like to take only the data that started with my_*. Is there some more elegant…
-
1
votes2
answers372
viewsPHP in_array() function
I’m developing a system that takes the ID’s from categories that are stored in the database, separated by ,, am using explode, turning them into a arrayand soon after I’m using the function…
-
1
votes3
answers252
viewsArrays not started in C
How do I know how much size I have to put to scroll through an uninitiated array []? For example this one with char[]. #include <stdio.h> #include <stdlib.h> int main() { char texto[] =…
-
1
votes1
answer955
viewsAngularjs indexof de Object
Every time I select a Bundle, add in an array, example: Items are some data I picked up, I just passed a few for testing var items = [755, 20, "E", 274] $scope.selectBundle = function(){ var info =…
-
1
votes2
answers634
views -
1
votes2
answers40
views -
1
votes1
answer353
viewsUndeclared variable
You’re making a mistake on lines 118,127,133,139... 127 20 'vector' was not declared in this Scope #include<stdio.h> #include <stdlib.h> #include <string.h> #define tamanho 5 int…