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
votes1
answer98
viewsHow to insert an instruction into the array only if it is true?
I need to somehow verify if there is any element within a given array and if there is, put a whole string in a specific place. For example: I need to check whether $categoria is not empty $categoria…
-
-2
votes1
answer724
viewsRemove square brackets from an array
You would need to remove the brackets from a print of the results of an array within a While. Follow code: <?php $termo = $_GET['termo']; include "conn.php"; //Consulta busca informações para…
-
-2
votes2
answers479
viewsDoubt about method of sum
How to make a method that takes as parameter an integer vector, computes the sum and returns the sum? I tried to do so, but it did not work, the sum is not held. public static void main(String[]…
-
-2
votes1
answer157
viewsComparison of elements of a vector with "strcmp()"
In the following function I want to compare the elements of a array of 1000, but I can’t find a way to successfully compare them, even using strcmp(). void verifica_conta(int *ptr) { int i;…
-
-2
votes3
answers7818
viewsRead multiple scanf numbers separated by space
I need to make a program that receives a number of elements from a vector, and then each element of that vector, but in the same scanf with spaces. Only I don’t know how to do this, someone can help…
-
-2
votes1
answer63
viewsHow can I rearrange this array?
I have the following array: $array_atual = array ( 'id_item' => array('1', '3'), // 'id_item', 'id_item' 'cantidad' => array('15', '10') // 'cantidad', 'cantidad' ); I’d like to leave it this…
-
-2
votes1
answer611
viewsHow to check if a field of an array of chars is empty in Java?
I am trying to check whether a particular position of an array of chars actually contains some character. I tried it two ways: char[] arr = new char[10]; if(arr[0] == null){ } And also: char[] arr =…
-
-2
votes1
answer79
viewsInsert n points of a vector randomly into any matrix in java
I’m beginner in java, I was wondering if there is any function that would facilitate my life so that: having a vector of n positions filled with (pre-defined) numbers, distribute these numbers at…
-
-2
votes1
answer34
viewsHow to verify that the limit of a vector has not been exceeded?
Good afternoon, gentlemen! I’m doing a college paper that asks me to create an agenda. I did most of the code, but I’m not able to see the light so that when the user tries to register a person in…
-
-2
votes2
answers3399
viewsAdd a new literal object to an object array!
I would like to add a new item to my object array through a method, but I don’t know how to do it. public products: Array<Object> = [ {prodName: 'product 1', prodElement: 'element 1',…
-
-2
votes1
answer190
viewsPHP script for counting comma-separated records
In the databank I have a column that takes strings in this format: ["87","12","67"] What I need is to count each value separated by comma and assign to some variable, remembering that there are more…
-
-2
votes1
answer106
viewsJava array problem to read from database
I have a Java function where I weigh a phone number and it returns me which trunk the call will exit according to the regular expression that is saved in database in a column called…
-
-2
votes2
answers335
viewsHow to insert space in Camelcase string?
I’m looking for a way to separate string from an array object, coming from an API, for example: Pageviews, get Page Views, I’m using VUEJS.
-
-2
votes1
answer1127
viewsHow to fill an Arraylist with values of another Arraylist caught randomly?
I have the class Vetor which will have a method to start an array with random numbers: public class Vetor{ private int tamanho; private int[] vetor; public Vetor(int tamanho) { this.tamanho =…
-
-2
votes1
answer59
viewsHow to compare numbers in vector list?
I have an integer vector list in java (Arraylist Listvet). public static ArrayList<Integer> ListVet; And I need to make a comparison between two numbers from that same vector list. So, I did…
-
-2
votes1
answer470
viewsTransforming elements from a string into a PHP array
mysql returns the following string: ["Element1", "Element2", "Element3", "Element4", "Element5", "Element6"] I need to transform each of the words between "" into an element of an array. I tried…
-
-2
votes1
answer37
viewsConvert php array
How do I turn this array: $rs = Array ( [0] => Array ( [DESCRICAO] => cadastrar ) [1] => Array ( [DESCRICAO] => editar ) [2] => Array ( [DESCRICAO] => deletar ) ) in…
-
-2
votes2
answers66
viewsHow to change the delimiter of the Php array obtained via POST by replacing the comma?
I receive an array via POST which is generated from a field name="Referencia[]" of the form, the problem is that in this array there is information with comma. Example: 2.7 cm, 3.1 cm. I enter in…
-
-2
votes1
answer93
viewsI can’t access the function
I’m trying to access the function getTitleIdLocation() in order to display the values I gave to the three variables, but I cannot. I cannot call the array in this way? Code: <?php class Imovel {…
-
-2
votes2
answers124
viewsArray Duvida JS
I’m having doubts and I’m taking a lot to solve this exercise someone could give me a Help?…
-
-2
votes1
answer28
viewsList With Gigantic Array
The software like output a list with only one giant array: [array([0.000000e+00, 1.687500e-01, 5.062500e-01, ..., 3.616745e+03, 3.617745e+03, 3.618245e+03])] My goal was to get a list, with each…
-
-2
votes2
answers61
viewsHow do I check the internal contents of an array?
How do I check the internal contents of an array? For example: var teste = [1, 2, 3, -4, 0] How do I check that the internal content is less than 0 within the array?…
-
-2
votes2
answers105
viewsphp array for json will not all data
Hi, I’m having a problem with my code and I wanted your help. I need to take data from a table and send it as json, I have 10 items in my table but json only sends one. Table: local In my code where…
-
-2
votes1
answer1708
viewsProblem with swapping vector positions
Good morning! Using Dev C++, I am making the following problem in C: Make a program in C that reads a 20-position vector of the real type. Replace the first position with the 11th, the 2nd with the…
-
-2
votes2
answers33
viewsidentify a value in the key of an array
The return of values stored on array $_POST is this: array(373) { ["ativar1"]=> string(17) "Ativar Permissões" ["copiar1"]=> string(0) "" ["p0"]=> string(1) "M" ["p1"]=> string(1) "N"…
-
-2
votes1
answer161
viewsDivide sum of values of a vector
I’m trying to divide/multiply all the numbers between themselves using vectors. for example: type 4 numbers and divide them all: 5/5/2/1 but I can’t get the division. follow the program: float…
-
-2
votes1
answer28
viewsError while displaying value
I am creating a contact list in php, and when I am sent all the data of the form for it to display to me, it displayed: 1, not my data that I entered. <?php session_start(); ?> <!DOCTYPE…
-
-2
votes1
answer83
viewsArrays_how to set more values in an Array?
I’m starting now in Js and I have something I don’t know how to do, Whenever the "store" function is executed, I need it to take values from an input, create new positions in an array, and store the…
-
-2
votes1
answer269
viewsPHP RANDOM NUMBERS EXCLUDING A NUMBER FROM THE LIST
Good afternoon, I need for a school work do a search of 7 numbers from 1 to 20, excluding a number from the list. Example: 7 Random numbers from 1 to 20, excluding the number 5 in the list. Return 7…
-
-2
votes1
answer41
viewsInvalid argument provided for foreach
I created a foreach to traverse a array which has 2 element but I wanted my foreach to get only the first element, I tried to use the [0] but my return was that mistake: ERROR: arning: Invalid…
-
-2
votes1
answer377
viewsHow to leave an empty array (delete all elements) in Javascript?
I have an array of objects and want to leave it empty by removing all its elements. How do I ? let arr = [1, 2, 3, 4, 5];
-
-2
votes1
answer49
viewsPlace an array in a Session
Hello, I have an array with a lot of values I need to pass to a session, I’m trying this way: array_push($array_tabela ,$tabela); $_SESSION['tabela'] = $array_tabela; But the problem is when I take…
-
-2
votes1
answer46
viewsHow to scan the matrix using only one for?
The circumstances are in the code that works: String[][] compras = new String[][] { { "item 1", "1.70" }, { "item 2", "39.90" }, { "item 3", "9.90" }, { "item 4", "4.90" }, { "item 5", "7.90" } };…
-
-2
votes1
answer103
viewsArray reading with JSON
I have the following array: Array ( [xml] => { "orders": [ { "code":"PedidoTeste-1508156986545", "channel":"PedidoTeste", "placed_at":"2017-10-16T10:29:46-02:00",…
-
-2
votes1
answer559
viewsVector union
How do I join 2 vectors into 1 single vector ? Without repeating the numbers ? Question: Make a program that reads two vectors of 10 elements. Create a vector that is the union between the two…
-
-2
votes1
answer107
viewsGet size of a two-dimensional matrix
I have a dynamically allocated two-dimensional char matrix, as I do to get its size? would use sizeof(client); for example, I instated a client struct, Client **client; then in the code I’ll…
-
-2
votes4
answers940
viewsJava: How do I store a vector in another vector and using Math library
my doubt is the following, I have to read 20 integer numbers in one vector and then I have to compute the square of that vector and store in another and then display the two. But when it comes to…
-
-2
votes3
answers114
views -
-2
votes1
answer604
viewsSeparate a single string in an array of strings
In this code I am trying to make a string read and then put each word separated by space in an array of strings. I saw that in some cases the Strtok function is used, but since I intend to use these…
-
-2
votes1
answer60
viewsHow to read items from one array within another?
This is my multidimensional array: <?php $beneficiarios = array ( array( "codigo_membro" =>$cod, "nome" => $_POST['nome1'], "n_identificacao" => $_POST['n_identificacao1'], "parentesco"…
-
-2
votes1
answer173
viewsShow Div and hide others that are visible with 2 arrays in Javascript
I have the following code based on JavaScript: var perguntas = new Array(); var respostas = new Array(); var totalPerguntas = 2; perguntas[1] = "Pergunta um"; respostas[1] = "Resposta um";…
-
-2
votes1
answer45
viewsHow do I display attributes of an object stored in an array?
I’m doing a job that consists of fictitious real estate. In this program there is a class called principal where it receives Immovel (Class) and stores the immovables in a vector, a class…
-
-2
votes1
answer64
viewsCheck for repeated number and delete
Enter the data in VET, and then check the repeated numbers, and leave in VET1 only the numbers that are not repeated, but I’m not able to do this last part at all, follow the code I’ve done so far:…
-
-2
votes1
answer210
viewsList all data of an API in numerical list (Array)
I have this Array: [tracks] => Array ( [data] => Array ( [0] => Array ( [title] => Amiga Da Minha Mulher [artist] => Array ( [name] => Seu Jorge ) ) [1] => Array ( [title] =>…
-
-2
votes2
answers1589
viewsHow to pass CSV file data to an array in Java?
I have a. CSV file with several numbers in two columns (1032,54832). I need to take these numbers and pass them to an array. How do I do this? I made a code to import the file and I can display the…
-
-2
votes2
answers70
viewsHow to remove 1 element from the Labels vector
Label[] posi={textf99, textf00, textf01, textf02, textf03, textf04, textf05, textf06, textf07, textf08, textf09, textf10b, textf11, textf12, textf13, textf14, textf15, textf16, textf17, textf18,…
-
-2
votes3
answers1158
viewsEven-odd vector fill C
Good people are caught in a little problem here I will put the statement here: "In this problem you should read 15 values put them in 2 vectors as these values are even or odd. However, the size of…
-
-2
votes1
answer149
viewsPython array [HELP]
Description: Make a program that displays the average between the highest and lowest value of an integer vector with twenty user-given elements and, at the end, displays only those elements that are…
-
-2
votes1
answer65
viewsI want to save 3 numbers and then print on the screen
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] vet = new int[2]; int i; for (i=0; i<2; i++); {…
-
-2
votes2
answers700
viewsHow to know how many positions an array has in Java?
Look at the picture; I’m uploading a CSV file, and I’m already able to count how many lines there are, in our context are three lines as shown in the code below; However I need now and how to get…