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
-
0
votes1
answer658
viewsHow to count repeated arguments in R
I have a spreadsheet, I have to do some operations in the data, so I exported to R and can select the important arguments, now I need to know how many repeated elements there are in a column: for…
-
0
votes1
answer242
viewsHow to extract a value from a JSON return
I have the following JSON { "cep": "11702-705", "logradouro": "Avenida Presidente Castelo Branco", "complemento": "de 4224 a 4800 - lado par", "bairro": "Aviação", "localidade": "Praia Grande",…
-
0
votes1
answer113
viewsExtract returns Undefined variable on the detail page
I am with the following variable indefinite error, I am developing a shopping cart using Friendly Url. Everything was going fine until I got to the part of returning all the contents of my product…
-
0
votes2
answers400
viewsI need my php function to be recursive
I need this function to be recursive, I’m beginner in php and I’m not quite sure how to do this. :/ <?php function mostraArray() { $cena=array($_REQUEST["numeroa"], $_REQUEST["numerob"],…
-
0
votes1
answer627
viewsHow to save information to an array?
Java masters, I am learning about matrices, vectors and I would like to know what happens to my code, because I create a matrix to receive six names and six positions for the employees matrix. Only…
-
0
votes0
answers36
viewsPrint array on screen as text
How do I print the contents of an array on the screen using text() in the Processing language? I have the array pieces: final int MAX_SIZE=56; char[] pecas= new char[MAX_SIZE]; I added 6 in the…
-
0
votes2
answers300
viewsMultiply value in array
How do I multiply the elements of an array? what am I doing wrong? For example, if I have: int numbers[]={1,2,2,4,5,6}; and my card_block is 2, the restutado would 1x4x5x6=120; int countCards(int []…
-
0
votes2
answers1282
viewsPass results from an Else if array
I have the following code: <?php $array = []; $ano = 2016; for($i = 1; $i <= 12; $i++){ $data = $ano . '-' . $i. '-01'; $inicio = new DateTime($data); $fim = new…
-
0
votes0
answers60
viewsMerge array via a comparison
I need to compare the arrays using the key called code, and if the keys are equal, join the arrays in a single array, see the example below: $array1 = array(array('id' => '1',…
-
0
votes2
answers475
viewsCreate arrays inside while
I have the following code: $urls = file_get_contents('https://www.google.com/#q=teste'); // teste é a palavra que vai pesquisar no google…
-
0
votes1
answer70
viewsCreate array and count values
I’m having a really hard time drawing a array in PHP with the following data coming from an object JSON, no, it does not come from a database SQL query. Example of JSON: [ { "data": { "ID": "349",…
-
0
votes3
answers1913
viewsReturn last index of Array
I have the following code that will bring me an undetermined list; for example 5 items. I would like to return only the last item from the list. for(var i = 0; i < data.list.length; i++){…
-
0
votes2
answers1321
viewsSearch Javascript array elements
I would like to create a input that receives a value informed by the user and that when clicking on a button he executed a function that checks if the value entered exists in my array and if there…
-
0
votes1
answer569
viewsHow to replace the contents of an array?
I have a div (users' mosaic) that within it has a array (javascript) with photos of users(data coming from the database). The amount of photos of users must be less than or equal to 15. If the array…
-
0
votes0
answers42
viewsArray x Arraylist
Yesterday I made a question on how to use a Two-dimensional Array dynamically, so I ended up getting a reply to use a Arraylist, and this served perfectly for my case, however, from that it…
-
0
votes1
answer57
viewsHow to place a value of a var inside an array item?
I’m touching the Google Charts, but I came across a situation, and I was wondering if you could do something like in the example: var numero = 45; var data = google.visualization.arrayToDataTable([…
-
0
votes2
answers38
viewsQuantity of elements that has at least the reported value
I have an array that can be any size, an example below: Array ( [0] => 40631 [1] => 40626 [2] => 40622 [3] => 40633 [4] => 59632 [5] => 40630 [6] => 40623 [7] => 40627 [8]…
-
0
votes1
answer73
viewsComparison of PHP Array()
I have the following arrays: $arrTag = "Array ( [0] => stdClass Object ( [id] => 1 [id_pacote] => 7 [id_fornecedor] => [nome] => Salgados - 100 Un [valor_compra] => 100…
-
0
votes1
answer841
viewsUpdating a field in Mongodb
Considering the following structure: { "_id" : ObjectId("5ad69abb3630404194c80571"), "cnpj" : 2352345234523452, "razao_social" : "Lalala Ltda.", "fantasia" : " "aiufhdiua Ltda.", "dt_criacao" :…
-
0
votes2
answers1471
viewsTransform object array into only one array
I have a array multiples objects: array(3) { [0]=> object(stdClass)#5750 (2) { ["value"]=> string(16) "[email protected]" ["key"]=> string(18) "email_client" } [1]=> object(stdClass)#5254…
-
0
votes1
answer53
viewsGrab items from an array by converting to UTF8
Hello! My problem is this: I have a list of values in an external php file and when I use a include to call the values in my template the accented characters are replaced by queries. I wonder if…
-
0
votes1
answer769
viewsKnow how many positions were filled in a vector in C
I cannot display the filled positions in C. I need to return which positions are missing to be filled and which are filled. ex:"So far there are 3 registered students, thus enabling the insertion of…
-
0
votes1
answer59
viewsHow to take values from an array without array.push
Guys, I’m trying to get a user’s location and it keeps updating from time to time, searching, I found this method, however, I can not only do this with the current value of the array, it…
-
0
votes1
answer839
viewsHow to perform operations between arrays in python
Hi, I’m learning python, I saw the basics and I’m in a problem where I need to do operations between arrays. I have, for example, two arrays of equal dimension D. For each index I in the array, I…
-
0
votes2
answers54
viewsVector in C- Program Received Signal, Segementation fault
Hello, I designed a function that checks whether a number is present in a vector. A function takes as parameters the vector, the value to be checked and the number of existing elements in it. E…
-
0
votes1
answer582
viewsCalculation of Ruby Factorial
Create a Ruby script that reads 10 whole numbers and store them in an array. Then the script should calculate the factorial of each of these 10 numbers, and store the results in another array, and…
-
0
votes1
answer2071
viewsHow can I filter objects in an Array with Typescript?
Example: function isBigEnough(element, index, array) { return (element >= 10); } var passed = [12, 5, 8, 130, 44].filter(isBigEnough); console.log("Test Value : " + passed );…
-
0
votes2
answers774
viewsHow to randomize an Array in c++
There is a lot of material here about arrays ordering methods (quicksort, bubblesort, etc.) but I wanted to know if there is a "clutter" method of arrays, i.e., shuffling the elements of an array.…
-
0
votes1
answer54
viewsJoin different arrays in tree form?
I have a situation where I’m not finding a solution. Suppose we have two arrays as follows: array('br', 'com', 'example1' ) and other array like this: array('br','com','example2') what I would like…
-
0
votes1
answer812
viewsTraverse array and locate a character other than a number
The idea is to receive a 4 digit number and then perform a variety of accounts but there is an input condition: If in the middle of the 4 digits there is a character that is not a number then I need…
-
0
votes1
answer104
viewsError Arrayindexoutofboundsexception
I’m in that mistake: java.lang.ArrayIndexOutOfBoundsException: 1 at com.ronaldocarvalho.cursomc.resources.utils.URL.decodeIntList(URL.java:27) ~[classes/:na] at…
-
0
votes2
answers82
viewsWhat is the difference in the assignment of an already started matrix to an uninitiated one?
char nome[10]; nome = "w" //Aqui ocorre um warning, por quê isso ? char nome_dois[10]; nome_dois[0] = "w" // Aqui e normal, como esperado. "w" is in a static memory? nome[0] is in a dynamic or…
-
0
votes1
answer2358
viewsC# - How to print all the values of an array with the Console.Writeline(??);command?
//Copy an array and print the 2. int[] original = new int[] { 2, 5, 3, 8, 9, 12, 15, 7 }; int[] copia = new int[original.Length]; for (int index = 0; index < original.Length; index++) {…
-
0
votes1
answer155
viewsHow to print on screen or console, a string array in php
I’ve been going through the documentation, but it’s unclear how I do it. I have an array of strings: $remetente = $con->real_escape_string($_REQUEST['rem']); $arrai= array(); $remetenteArray[] =…
-
0
votes3
answers856
viewsConvert a number array to a single String in php
as I transform an array of numbers into a single string in php? In the code below the variable $result is the array of numbers, and I tried to convert it to a single string with the function…
-
0
votes0
answers35
viewsOutofbounds Error
Good, I would ask you to help me with this mistake! This is part of a game code, the idea and print something like this M M M 123456789012345678901 1 2 M positions will vary with each move, Thank…
-
0
votes1
answer47
viewsDifficulty handling the query
Personal I have the following query: SELECT p.ra, p.nomealuno, qa.respostaaluno, q.respostacorreta FROM prova p INNER JOIN questoes_aluno qa ON qa.idprova = p.id INNER JOIN questao q ON q.id =…
-
0
votes1
answer65
viewsarray type has incomplete element type
I am not able to compile my program, the compiler keeps accusing "array type has incomplete element type" in the function that prints points. The function that prints dot: float imprimePonto(struct…
-
0
votes2
answers1127
views -
0
votes1
answer533
viewsHow to use Foreach in a multidimensional array in PHP
I would like to know how to run the entire array only with Foreach: $Marcas = array(array('Fiat', 'Volkswagen', 'Audi'),array('Yamaha', 'Suzuki', 'Honda'),array('Samsung', 'Motorola', 'Apple'));…
-
0
votes0
answers16
viewsHow to use each and list in a multidimensional array
I need to go all the way array multidimensional with each and list only. This is the code: $Carros = array( array("BMW", 130000, "Novo"), array("Strada", 40000, "Usado"), array("CRUZE", 100000,…
-
0
votes1
answer51
viewsNeeding Help in Vector C Exercises
Why aren’t you showing the 15 numbers? And how to include 3 numbers at the beginning of this vector? int main() { int v[30]; int i,x; for(i=0; i < 15; i++) { printf("Digite 15 numeros");…
-
0
votes3
answers69
viewsAdd items to the beginning of a vector without affecting existing values
How to include 3 numbers at the beginning of this vector without affecting the previous numbers? I’m trying to do it this way: int main() { int v[30]; int i,x; for(i=0; i < 15; i++) {…
-
0
votes1
answer55
viewsLoop for from index 1 java array
I have a function that makes a loop for in a String array. I need the loop to start from the index[1] of that array. But I’m not getting it. String arquivo[] =…
-
0
votes2
answers279
viewsHow to remove null value from a foreach or array
I am making a query in a table that has a blank value(student:note). On one page I do the function with select and play the array on a Return to call on another page, but I can’t delete the blank…
-
0
votes1
answer135
viewsWord in reverse order
I’m doing an exercise where I have to make the word given with input exit in reverse order. I start by counting the number of letters you have in the typed word (commented on in the code). After…
-
0
votes0
answers238
viewsExcel VBA with slow array s to taratar data
I am developing a code to be applied in excel that summarizes the number of defects in a summary table. The data is imported from an xml file, which is opened by excel and created "layout" by excel.…
-
0
votes1
answer76
viewsCounter adding an extra value to the vector with pointer
I’m trying to finish an exercise that asks for 4 ages and the output tells how many of the inserted ages are greater than or equal to 18 but the counter always adds a value greater than 18 at the…
-
0
votes1
answer191
viewsProblem with empty Array with mysql and nodejs
This is the action that is activated by loading the page: In it I get the following array below. My problem is, when there is no record the ARRAY returns empty, I cannot pass a parameter to INPUT.…
-
0
votes0
answers37
viewsQuery with Arrays not working PHP SQL
To edit a report, I need to take everything and turn it into an Array. I cannot use UPDATE, because the user can add more lines, having q add. Thus, I thought of first deleting the data that…