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
votes2
answers40
viewsHow to list an Array in a checkbox, breaking by one of the Array items?
I have the Array below: this.ca = this.categorias = [ {cate: 'oquefazer' , tipo: 'ACESSIBILIDADE:', nome: 'Cadeirante' , icone: 'fa-wheelchair'}, {cate: 'oquefazer' , tipo: 'ACESSIBILIDADE:', nome:…
-
0
votes1
answer45
viewsPrinting vector memory garbage
How do I make a program not print vector trash? For example, I created 2 vectors at the beginning of my program with 5 elements each. If the user type numbers above 10 stores in v1 if it is larger…
-
0
votes1
answer24
viewsTrash value in a C array
I am making a program whose function is to import the values of a file . dat and put them inside a vector. For this, I made the following code: void Import_vec(int tamanho,const char caminho[],float…
-
0
votes2
answers43
viewsHow to pass product information with parameters and pull in shopping cart?
i am new in the programming area and am creating an Ecommerce, until I came across the following situation when submitting my form via ajax. Items sold on the site have parameters, for example: The…
-
0
votes2
answers39
viewsPicking a vector within an R matrix
I’m doing an exercise* for my R studies and I’m not able to properly manipulate matrices. The problem is very simple, apparently. I have a matrix’m' m <- rbind( c(1,1), c(1,2), c(3,3), c(2,0)),…
-
0
votes0
answers13
viewsHOW TO GET A COMMA OUT OF THE ELEMENTS OF THE VECTOR
Save guys, I’m making a code and I have to show the result of my vector in html, however the result is showing all with comma and I want to take these commas leaving everything together. example: my…
-
0
votes1
answer71
views -
0
votes1
answer33
viewsProblem when trying to split an array of randomly ordered numbers into two equal parts using Godot/Gdscript
I am currently creating a game in Godot 3.2.3, and in this game I need to create an array that contains numbers from 1 to array.size() (example:[0,1,2,...,30]) and that such numbers are in random…
-
0
votes1
answer38
viewsRepeated hunch
Hey, here’s my problem. I’m developing an application in c# (console) to learn c# and I’m having a problem that I can’t solve. First I draw the numbers that will be drawn: Random rnd = new Random();…
-
0
votes0
answers32
viewsremove part of a php object array
Good night. I’m trying to foreach an api response. She comes to me like this: { "page": 1, "results": [ { "adult": false, "backdrop_path": "/9WlJFhOSCPnaaSmsrv0B4zA8iUb.jpg", "genre_ids": [ 28, 27,…
-
0
votes1
answer53
viewsString array printing error // C++
I am making a force and in the printing of the drawn word, there is an error in which the words are printed with some numbers or letters not included in its scope. const int quant_palavras = 3;…
-
0
votes0
answers36
viewsHow to resolve Signal: Segmentation fault (core dumped) in C++
I’m trying to make a noose and on that part, always gives the core error dumped. how can I solve this problem? cout << newnome1 << ", ESCOLHA UMA PALAVRA: "; cin >> palavraSecreta;…
-
0
votes0
answers39
viewsHelp with C Vectors
Staff helps me out on a C. I have a lottery question. My lottery looks like this: 5 numbers from 1 to 60 and 1 number (sixth) from 1 to 4. I generated an X vector to generate 5 random numbers…
-
0
votes1
answer19
viewshow to use the array.find method to find an attribute of an array that is formed by the contents of the localStorage?
I have an empty array that receives via push the content of the localstorage (which is also an array), however, when I give a.find vector to find the value of an attribute, such as _name, it does…
-
0
votes1
answer21
viewsHow do I send a multidimensional array via a post to receive in a form?? in php
<?php $funcionarios = array( array("nome" => "Pedro", "idade" => 24, "salario" => 2245.32, "filhos" =>3, "ativo" => true), array("nome" => "Rossana", "idade" => 35, "salario"…
-
0
votes0
answers24
viewsSave Array to Mysql using Nodejs
I have a form I’m making with Vuejs and Nodejs to the Back-End. I have a checkbox that gives me a value in Array, and wanted to save these values in the database, and when I try to save, it error…
-
0
votes1
answer51
viewsFunction that adds digits of a number - C++
Good evening guys, I’m working on a program that generates a 10x10 matrix, with numbers between 100 and 999, and finally that I make the sum of the digits of each generated number, ex: if it came…
-
0
votes0
answers12
viewsLocalization of user points with Haversine (Javascript) - How to improve code (or logic)?
Hello. I’m trying to recreate a program that I did some time ago, where one of the functions is: Insert coordinates in geodetic decimal format (Ex: -30,023927) Locate the three closest points to the…
-
0
votes0
answers14
viewsJSON.stringify returns the JSON string, but when trying to send to a MYSQL BD it escapes backslash
I am trying to register a JSON String in Mysql, I get an array with URL’s after a .map on the return of a request to upload multiple images to AWS S3, I use JSON.stringify to leave the array in…
-
0
votes1
answer60
viewsReact - Redux: Typeerror: Cannot read Property 'map' of Undefined
I am trying to render some products coming from my api, however I get this error: Typeerror: Cannot read Property 'map' of Undefined Follow the code of the action: export const listProducts = ()…
-
0
votes2
answers81
viewsCheck which numbers are primes within a vector
I’m having a hard time with this activity: b) Module that takes as parameter an array of integers and returns the number of primes in the vector. This module should call the function IsPrime of the…
-
0
votes0
answers17
viewsConvert a query string with array to object with Javascript
Hello :) I have a query string that I would like to transform into object, but this query string has an array that is converted as follows: &meuArray[0]=17&meuArray[1]=1 When I convert this…
-
0
votes0
answers36
viewsPointer pointer in C
Come on, guys, I’m trying to understand the pointer-pointer behavior, but I can’t figure it out. Well, I already have an idea that the pointer points the memory address of something, to another…
-
0
votes0
answers34
viewsDifficulty in understanding problem solving
My problem is this; I was solving some exercises of the hacker rank platform and I came across a question that asked me to identify the only value in an array that did not repeat. I couldn’t think…
-
0
votes1
answer29
viewsAutocomplete dropdown menu
I implemented a Autocomplete system in one of my form inputs and wanted to know if I can return the result of several arrays. The system serves for scheduling bath of a pet shop and I wanted to…
-
0
votes0
answers25
viewsArray return in C#
When I assign a function that returns an array to another array, I do not have the corresponding values of each index as assigned within the function. I need to return three percentages that are…
-
-1
votes2
answers123
viewsHandle missing variables in array
How to mount the following array if one of the variables is not defined? $a = 1; $b = 2; $d = 4; $array = array($a, $b, $c, $d); The values of the variables ($a, $b, $c and $d) come from a server…
-
-1
votes1
answer651
viewsArraylist returning null values
Well, I have an array, I add values to that array, I send them to a method in another class that puts the values of that array into one string only and I add that single string into an Arraylist,…
-
-1
votes1
answer74
viewsHow to organize matrix
a comparison is being made: this way $result3 = array_diff($fetchForm, $items['form_id']); print_r($result3); Array ( [0] => 1 [2] => 3 ) $result2 = array_diff($items['form_id'], $fetchForm);…
-
-1
votes1
answer501
viewsHow to read multiple TXT files and save the strings in a Nsarray?
Explanation of the scenario: Read the contents of various extension files .txt and save the strings of each file separately in one NSArray, in this case, in each index of the array. Obstacle: -…
-
-1
votes1
answer1593
viewsForeach repeating the same content
Setting I have a form and via POST send to the page preview.php 10 song names that are divided between 4 arrays. I can generate the 10 Divs containing the position array but when I create the…
-
-1
votes2
answers184
viewsOptional shopping cart
Positive added / Negative removed ([1] => 3 [6] => -2 ) Next customer can change all snack settings contains a default amount (recipe) It can pull out 2x and can add 1x 2x 3x lettuce in case…
-
-1
votes1
answer1018
viewsHow to dynamically mark checkbox fields with PHP?
I’m sending neighborhoods by $_GET through a form and would like to mark them dynamically in updating the screen thus making a system of persistence of the search results. <fieldset…
-
-1
votes4
answers765
viewsHow to put a DB column loop inside an array?
I have a database with dynamic columns that can appear one time, another time not... can also be added more columns or even extracted the ones that already exist. I made a code that allows me to…
-
-1
votes2
answers307
viewspass php value to js giving error
<!DOCTYPE html> <html> <head> <style> table { width: 100%; border-collapse: collapse; } table, td, th { border: 1px solid black; padding: 5px; } th {text-align: left;}…
-
-1
votes2
answers280
viewsCheck the diagonal of a specific index
I wanted to know how to check the diagonal of a particular index, for example, put 1 in all the numbers of the diagonals of row 2, column 2 0 1 0 1 0 0 1 0 0 1 0 1 1 0 0 0…
-
-1
votes1
answer339
viewsScroll through an array and separate the same names to make the appropriate changes
I need to scroll through an array that has the following elements: $MeuArray = array("PEDRO" ,"PEDRO" ,"PEDRO" ,"PEDRO" ,"JOAO" ,"JOAO", "JOAO", "JOAO"); I need to separate by equal names, example:…
-
-1
votes1
answer4866
viewsHow to add or remove a vector element?
From a vector, how can I remove or add an element?
-
-1
votes1
answer110
viewsProblem when displaying array
I have a problem in logic to display data from an array. Is the following: I have a function, which returns the result of entries per UF per day. In it I step 2 parameters, an array with the dates…
-
-1
votes1
answer52
viewsDoubt with array search
my question is the following: How do I search a key and return its value? Ex. $contagem = array('metodologia' => '1','facilidade' => '10') would like to search for ease and return the value…
-
-1
votes1
answer225
viewsSave user input to a loop
I want to get the variable list numeros, generated by the following loop: Scanner kb = new Scanner (System.in); double [] numeros= new double[10]; for (int i = 0; i < numeros.length; i++) {…
-
-1
votes1
answer186
viewsHow to extract data in the form of indexes from this array?
I’m developing a real estate website and I will use the REST. The code below returns me one by one the properties registered in the server software as can be seen here. $dados = array( 'fields'…
-
-1
votes2
answers1224
viewsHow to transfer data from tables to python?
Hello, I have a table with a lot of data, a lot of data even from Astrophysics, are tables with approximately 20 columns and more than 1000 rows. I need to send this table with this data (contained…
-
-1
votes1
answer138
viewsHow to concatenate strings from a 3-in-3 vector in Java?
I need to concatenate the elements of a 3-in-3 vector. Follow the sample of what I need: package ex; public class prog { public static void main(String[] args) { // TODO Auto-generated method stub…
-
-1
votes1
answer19
viewsReturn of values from a column of table X that has 1 code in common
I need to solve a big problem. I have a table of answers of a poll where the answers made with checkboxes are in different lines with a common code, that of the answered question, example:…
-
-1
votes1
answer61
viewsSorting PHP Array
How can I solve the following problem: I have 4 arrays that are concatenated (array_merge) and saw only one, but now I need to concatenate the vectors in a different way. I need to take index 1 of…
-
-1
votes1
answer93
viewsWhy does the following code not work?
The code should receive a number of student grades, print the grade average and how many grades are 10% below and 10% above average. The code is like this: quantidade = int(raw_input()) inicio = 0…
-
-1
votes2
answers49
viewsParse error: syntax error, Unexpected ','', expecting ']' in D: wamp64 www PROJETOS- sist-Crop jcrop m2brimagem.class.php on line 40
How do I fix this syntax error? $this->extensoes_validas = $extensoes_validas ['jpg','jpeg','jpe','gif','bmp','png']; What I wanted was to assign this array to $this->extensoes_validas…
-
-1
votes1
answer133
viewsUndefined index array Pdo
good people I’m trying to get the id of a user who logged in and saved in the session but , not working, I make a query in the bank when logging in and turn the result into an array to pick up the…
-
-1
votes2
answers68
viewsVector by Parameter in C
I need to pass the Vector position by parameter as follows code, my function receives the address and modifies directly the variable passed by parameter. But the program stops working and closes…