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
votes1
answer71
viewsGet Object id[]
I need to get the id of these objects. Object[] classe = getNames().toArray(); String[] strings = Arrays.stream(classe ).map(Object::toString). toArray(String[]::new); for (int…
-
-3
votes2
answers39
viewsPass an array to another format
The array is coming in this database format: array (size=12) 0 => array (size=3) 'maquinas' => string '111' (length=3) 'mes' => string '1' (length=1) 'YEAR(data_ordem)' => string '2016'…
-
-3
votes5
answers9010
viewsHow do I multiply an array within a function in JS?
The question is basically this: We need a product function that takes an array of numbers and returns the product: the result of multiplying all the elements among themselves. For example,…
-
-3
votes5
answers5734
views -
-3
votes1
answer39
viewsInclude several elements in the Array
I’m trying to load an array with the elements that are in a variable. I’ve tried several ways, but I’m not getting it. Follow a print of my code with Debug. I appreciate the help. Eduardo As can be…
-
-3
votes2
answers88
viewsPower calculation
Make a program that receives a 200 position vector (int) Next create a function that returns the power squared of each element of the vector. The main program should display all results on the…
-
-3
votes1
answer461
viewsHow to insert values into an empty array?
for example : var arr = [] . How to insert elements into this empty array? I tried many more unsuccessfully. I tried to do it more dynamically without success.
-
-3
votes1
answer100
viewsDoes anyone know how it is possible in postgresql, I have two tables with column type ARRAY and use WHERE, to select the records by this column?
I have two TABLE . TAB1 and TAB2 TAB1 GROUPS = {11, 15, 13, 20} TAB2 got the spine: REG1 GROUPS = {11, 8, 15} REG2 GROUPS = {21, 5, 7} REG3 GROUPS = {1, 13, 21} Make a SELECT using the table column…
-
-3
votes1
answer47
viewsclone array functions and objects
Make a function to clone arrays. (Tip: clone = [ ...clone ]) Make a function to clone objects. (Tip: clone = { ...objeto }) let total = 3, array1 = [1,2,3] const clonar = () => { if (total ===…
-
-3
votes1
answer31
viewsHow to always take the next 2 elements of a string
I have the following string: gxAjaxKey = "FF00FFFFFFFF2426FFFFFF046448FF70" I must take 2 elements at a time from this string and convert to byte: FF = 255 00 = 0 FF = 255 . . . 70 = 112 I wrote the…
-
-3
votes1
answer70
viewsHow to remove the first element of an array in Javascript?
I would like to know how to remove the first element of an array. //Array atual: [1, 2, 3, 4, 5] //Como quero que fique: [2, 3, 4, 5]…
-
-3
votes2
answers39
viewsHow to divide an array of 90 elements into 20 on each page, in PHP?
A query via mysqli (in PHP) returns me 90 lines in an array. How do I print a maximum of 20 lines on each page ? I developed it as follows, but it’s still too grotesque: Can someone help me perfect…
-
-3
votes2
answers163
viewsString replacement in javascript
I have an input that receives a code composed of 4 letters <p>Localidade <input type="text" id="localidade" oninput="MyFunction()"> <span id="ca"></span> </p> I intend…
-
-3
votes1
answer1154
viewsProgramming a movie function - Characters
Program a movie function that receives three arrays with the names of characters, movies and year of debut in the cinema. The role should also receive an id value chosen by the user with a range of…
-
-3
votes2
answers560
viewsJavascript - Splitting into an array
I’m trying to solve an exercise, and I’m having a hard time finding out where I’m going wrong, some hint? Exercise : Program a function buscarDivisivelPor which receives two parameters, one array of…
-
-3
votes2
answers354
viewsHow to separate items from an object array by dynamic types?
How do I separate items from one array of objects by a type that each object has? Remembering that types are known only at runtime. For example: [ { id:1, name: maria, tipo: pessoa }, { id:1, name:…
-
-3
votes1
answer49
viewsArray_search does not work
Does not locate the Array key number. Page code: $cnpj = "000000000000000"; $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);…
-
-3
votes2
answers104
viewspython vectors, help out?
I don’t know where I’m going wrong,. Make a program that reads a vet vector of 20 integers. The program must generate, from the read vector, another pos vector containing only the positive integer…
-
-3
votes2
answers135
viewsProblem with a list of selectable items that are stored in an array
Hello, I need to create a list where I can select one of the items and also deselect, but I’m having problems because the list only selects correctly if I select in ascending order and desiccate in…
-
-3
votes2
answers40
viewsWhy is my vector ordered if I am ordering in a function (void) without any return?
When sorting a vector, in a function of type {void} why the vector (original) in my function call is shown as ordered since the vector that was ordered was the vector referring to the formal…
-
-3
votes2
answers63
viewsInfinity C loop array
In this example below, how do I print on the screen all values assigned to n during the loop, after its completion? #include <stdio.h> #include <conio.h> int main (void) { int n; for…
-
-3
votes1
answer44
viewsI’m having a problem with my code I can’t bring the data from one function to another!
I’m having a problem with my code I can’t bring the data from one function to another!! in the case of Function sum I cannot print it in function print. Can someone help me 1 - Insert into a vector…
-
-3
votes1
answer45
viewsShow result of a random array!
Good evening! I’m new to Javascript. I did a study of the word memorization type where I pick a certain number of words within an Array. The words are random and shown one by one. But I would like…
-
-3
votes3
answers54
viewsI wonder if I can modify a string inside an array without knowing its position
Ex: const array=[...'indice n','indice n2',...] After modifying: array = [...'maçã','indice n2,...'] function checkForTranslation(){ var input = document.getElementById('inputTextField').value var…
-
-3
votes0
answers16
viewsArray check
I need help to check if the product of the code entered is registered in an array, if it is, the data will be displayed and will be requested to read the amount of input of the same product. case 2:…
-
-3
votes0
answers41
viewsTest Template Check - Language C
I have a question I need: Read the proof feedback; Read the students' names; Read each student’s answers. At the end of the program I must print: the name of the student + how many questions he got…
-
-4
votes1
answer70
viewsSend 10 values using the POST method, the values should be entered in a vector
The goal is the following: send 10 values using the POST method through the form, and insert them into a vector, which will later be printed. Anyone who can help me thank you.
-
-4
votes1
answer159
viewsTraversing array and separating by commas
I have an array, and with the var_dump she returns it: array (size=2) 0 => array (size=2) 'id' => int 18 'name' => string 'Drama' (length=5) 1 => array (size=2) 'id' => int 10765…
-
-4
votes2
answers79
viewsQuestion about array in php
I’m cracking my head and I’m already out of ideas, summing up my code is like this: <?php $var = 'arquivo_1'; // podendo ser arquivo_1 ou arquivo_2 $arquivo_1 = array( "algo1" => "alguem1",…
-
-4
votes1
answer328
viewsError "Invalid argument supplied for foreach()" and "Undefined index" in PHP form
I must create 20 inputs that when filled out should show what was typed in them right below, using arrays and foreach, here is the code below: function repeteInput(){ for($i = 1; $i <= 20; $i++){…
-
-4
votes1
answer36
viewsHelp with Array
I’m having a problem with javascript. I have an array with 500 positions, I want to print all the data in my html. But when I throw this dice into a div it pulls only the last element. I appreciate…
-
-4
votes1
answer59
viewsFunction with three parameters in Javascript. Error returning "true" or "false". What to do?
I need a code that signals TRUE when the age is >= 21 years and the height >= 180 cm. The code I made is not working and I don’t know which error shows. =/ function maiorAlto(nome , idade ,…
-
-4
votes1
answer41
viewsBest way to know if an object array has the same values, even at different positions
I would like a help for a function, where I have to know if two objects have the same values, even if in different positions. In this case they have the same values. I’ve seen how to do with arrays,…
-
-4
votes0
answers19
viewsError when adding Big Decimal elements
I need to add all pre-defined elements to the elements that will be inserted by the user, but gives error when instantiating Bigdecimal private BigDecimal concentracaoK; private BigDecimal…
-
-4
votes0
answers23
viewsGood afternoon, I’m a beginner and would like your help
Oops guys, I’m a beginner in the field and would like course tips, or any other kind of improvement and improvement in my C/C language development++. I am in the 2nd period of Computer Science and I…
-
-4
votes1
answer32
viewsSort array in PHP by key value (With fields with integer values)
I have a multidimensional array of type echo "<pre>"; print_r($order_info); exit(); Array ( [0] => Array ( [order_product_id] => 3227 [seller_id] => 27 ) [1] => Array (…
-
-4
votes1
answer31
viewsPhp and Javascript - Pass javascript array to Php function on the same page
good afternoon, I have an html with some checkbox: <input type="checkbox" name="item" value="UM" onclick="verificaChecks()">1 <input type="checkbox" name="item" value="DOIS"…
-
-4
votes1
answer72
viewsHow to pass the array from a method to Another method using interface
I want to create a program that uses interfaces to create a vector class with name and size and have the methods below: <> +Definirnometamanhovetor +PreencherVetorCriadoInformandoPosicaoValor…
-
-4
votes1
answer55
viewsCompare object array and delete repeat
I need to make a method where I receive from the frontend an array of objects, and compare with the array of objects q have in the database, so I perform the query in the database that is data1 and…
-
-4
votes0
answers29
viewsIn Bigquerym, how to find a text in a column based on another table and column
I made the example below with a blocklist table (where I have all the words that cannot appear in a product description). The product table, where I want to find these blocklist words in the product…
-
-5
votes1
answer199
viewsVectors, pointers and memory storage
I need to solve an exercise where I need to use pointers, vectors and memory storage: Create a vector with n elements, and each vector position will match a pointer to a value of type float. Make…
-
-5
votes1
answer75
viewsHow to transform this array into an array of 4 indexes?
Array ( [0] => Camaquã,Cavalhada,Cristal,Hípica ) I need to transform the array above in an array of 4 indexes as seen below. Array ( [0] => Camaquã [1] => Cavalhada [2] => Cristal [3]…
-
-5
votes2
answers73
viewsWhat does this code do? I need a description of how it works
$links=array("Apache Server" =>"www.apague,org", "Apress" =>"www.appress.org", "PHP" =>"www.php.net"); echo "Links "; $cnt=0; foreach($links as $key => $value) { echo $value .' -$cnt…
-
-5
votes1
answer106
viewsArrays in loops
I could not resolve the following doubt: Fill in the blanks to print all elements of a array arr containing 3 elements: for(int x=0; x<___; x++){______<<______[x]<<endl;}…
-
-5
votes1
answer4423
viewsLaravel foreach view
I have this array and it can be infinite, with several children https://jsoneditoronline.org/? id=cff2cb9795a64273142b24b83e73ffe3 how I do a foreach on that in a view?…
-
-6
votes2
answers208
viewsPHP - associative array: check the amount of elements within a value (which has an array) of a key
I have an array like this: $array = array( user => "user1", name => "name1", books => "book1", "book2" ); I want to go in Books and check the value that elements have inside it, in case it…