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
answer79
viewsHow to organize arrays
In the documentation of Pear, it sets a pattern for how to mount the structure of an array: $some_array = array( 'foo' => 'bar', 'spam' => 'ham', ); This way, which I already use, separates in…
-
3
votes2
answers128
viewsUse of conditions in matrices
I need to do a program that reads a 4X4 matrix and then sums the values in each row and then for each column. I’m not sure how to define my condition. #include <stdio.h> int main() { int…
-
3
votes2
answers344
viewsSegmentation Fault (core dumped ) Array reading
I have a problem related to reading a array that produces the error Segmentation Fault (core dumped ) This is only the beginning of code development, but already presents an error after reading the…
-
3
votes3
answers8198
views -
3
votes2
answers129
viewsSorting Doubt - C Language
I am ordering a simple vector, increasingly. The code works. But the next line that got me confused: if (matriz[i] < matriz[j]) Why is the sign there smaller, not bigger? If I want to change…
-
3
votes2
answers1736
viewsHow to separate array in odd/even and calculate multiple number?
I’m making a script to separate odd number and even number of an array inserted via form option, and make specific calculation on them (to separate odd number from pair array I’m using explode and…
-
3
votes2
answers140
viewsProblem inserting data into a vector
I have the Door, Building and Main classes: public class Porta { boolean aberta; String cor; double dimensaoX, dimensaoY, dimensaoZ; void abre() { this.aberta = true; } void fecha() { this.aberta =…
-
3
votes1
answer105
viewsTest if method removes a list item (Jasmine)
I have a method in a service that removes items over 60 days from a list. self.removerAntigas = function () { var dataCorte = new Date(); var dataAux = dataCorte.getDate(); dataCorte.setDate(dataAux…
-
3
votes1
answer132
viewsCopy, Paste, and Crop an Array of Java Integers using Clipboard?
Personal greetings, I was trying to perform the processes of Copy, Paste and Cut using an Array of integers in Java, but I found a lot of difficulty and little material (mainly in Portuguese).…
-
3
votes1
answer192
viewsVector start with element greater than 0 (zero)?
Usually a vetor starts from the element 0, and so on until you get to the size of which it was declared or assigned, example: string[] v = {1, 2 , 3}; // equivalente á: v[0] = 1; v[1] = 2; v[2] = 3;…
-
3
votes1
answer88
viewsNegative return from Array.Binarysearch()
I needed to make a comparison of the kind of methods normally created as inList or something like that. When searching the Microsoft documentation, I found the Array.BinarySearch(T[], T). I…
-
3
votes1
answer61
viewsGet values from Arraysegment
By creating a ArraySegment, would like to get the new array created, but when using: meuSegmento.Array; the array original is returned and not the created segment. string[] meuArray = {"stack",…
-
3
votes3
answers8393
viewsZeroing position of a vector to ensure there is no dirt
How do I reset the position of an integer type vector, for example, to ensure that there is no "dirt" when allocating the position in memory in C++? Some language function or an algorithm.…
-
3
votes1
answer76
viewsDocument.querySelect in body
How to use code session document.querySelector to change/change the background image of a page <body>...</body> Ex: var imagem_lista = […
-
3
votes1
answer296
viewsHow to mount a query with optional conditions?
In the example: SELECT * FROM exemplo WHERE ID in(2, 3, 4) He brings if he has these ID at the bank. How to mount a query which places this condition only if the array in PHP have elements? PHP:…
-
3
votes1
answer247
viewsI can’t do a word search between brackets in php
I created a function to check if some words exist in an array. I want to search for words within "[ ] brackets". Example: [how] [to give], [to love] ... For this, I am using the function…
-
3
votes3
answers37
viewsProblem adding a date to an array index
I’m passing a date inside an index of a Array. As the looping is being performed, this Array is being fed. The index is also generated through this looping. However, when printing the index, it…
-
3
votes2
answers2143
viewsLaravel - Session and Array
I need to create an array: array( 0 => 0, 1 => 0, 2 => 1, 3 => 0, 4 => 0, 5 => 1, 6 => 0) within a Session: session('session_array') and then individually add and redeem the…
-
3
votes3
answers744
viewsSplit array and sort
I have an array as follows: 'Ato001_1981', 'Ato002_1980', 'Ato003_1982', 'Ato003_1983', 'Ato004_1982', 'Ato013_1981', 'Ato013_1982', 'Ato013_1988', 'Ato031_1982', 'Ato032_1979', 'Ato039_1988',…
-
3
votes1
answer2388
viewsAccess attributes of an object vector of another class using C++ pointers
I am doing a job for the college in which I have to put together a program to manage a restaurant that only makes deliveries the orders are made by phone and internet using object orientation and…
-
3
votes1
answer36
viewsJavascript - Run Data from an array always in the same order
Good/Good Morning/Afternoon/Evening, I would like a Javascript help, how do I run data from an array always in the same order, example: var teste = ["valor1", "valor2"];…
-
3
votes3
answers270
viewsSimplifying an Array - PHP
I have a multidimensional array where the data lies as follows: Array ( [0] => Array ( [0] => Array ( [0] => Brasil [1] => Franca [2] => Italia [3] => China ) ) ) I would like a…
-
3
votes2
answers631
viewsProblem with Arraylist
I’m learning about Array and I’m racking my brain with this code, can someone explain to me why it’s not working? This error appears The type List is not Generic; it cannot be parameterized with…
-
3
votes1
answer894
viewsArray without repetition
How to do not repeat data at each run? Each time I Run, he ends up repeating the dates at the time of execution, as I do for Him to draw the dates without repeating them, and when he finishes the…
-
3
votes3
answers72
viewsMake copies of lists at certain positions with Python
Hello, please, I would like to copy a certain list in python. The total list size is 150 and I wish to remove the last 50 elements from the list. Here I will represent a list 100 times smaller, ie…
-
3
votes2
answers1618
viewsSort array by key, being a string
I have a random array containing in its keys, an alphanumeric sequence. Using the function ksort, get the following result: array(22) { ["A1"]=> string(2) "A1" ["A10"]=> string(3) "A10"…
-
3
votes3
answers1104
viewsChange of vector size in a structure
I have the following structure: struct Implicantes{ int posicao; char binario[5]; bool dontcare; bool tick; struct Implicantes *Next; }; It is possible to change the vector size of char "binary" of…
-
3
votes2
answers658
viewsCopy array in ADVPL
In ADVPL what difference to make: aArray1 := {"A", "B", "C"} aArray2 := aArray1 or aArray2 := aClone(aArray1)
-
3
votes1
answer52
viewsselect in elements that are not in the array
I have a PHP array with Ids: $idNaoEnvia['1', '3', '6'] And a table called account in MYSQL: ID | NOME 1 | caio 2 | antonio 3 | cleber 4 | marcos 5 | leonardo 6 | andre Wanted using PDO to give a…
-
3
votes1
answer559
viewsI’m having trouble displaying the names of people over 18
/*Escreva um programa que receba o nome, profissão e a idade de 10 pessoas, calcule e imprima a quantidade de pessoas maiores de idade (idade >= 18 anos) e seus respectivos…
-
3
votes1
answer354
viewsHow to sum array data in json specified by date
array(10) { [0]=> array(4) { ["data"]=> string(10) "01/11/2015" ["valor"]=> int(50) ["intensidade"]=> float(37.5) ["carga"]=> int(35) } [1]=> array(4) { ["data"]=> string(10)…
-
3
votes1
answer51
viewsCheck whether array is associative in a class
I have a class where I need to do certain checks on an array, such as checking whether it is associative or indexed. I know there is no native function in PHP that does this, so I could use the…
-
3
votes2
answers150
viewsRetrieve PHP data within a text
I have the following text:: $texto = "Olá {cliente}, seja bem vindo ao site {site}! Aqui você terá acesso as seguintes opções: {opcoes} Estes dados foram gerados automaticamente em {data} Pela…
-
3
votes2
answers1944
viewsRemove comma from the last foreach value in PHP
Good morning, I have a foreach in my system and I need to separate the items pro comma, then the foreach is like this foreach($value as $item){ echo $item . ','} the result obviously comes out:…
-
3
votes0
answers471
viewsSending computer vectors to the Arduino
Hello, I’m with a project that uses the Arduino to perform some operations for me. However, these operations use vectors. I need to somehow send a computer vector (other than by Serial) to the…
-
3
votes1
answer760
viewsAccess object array within a switch
Good evening, I’m having trouble accessing and modifying an array of main class objects inside a switch in the view class. The array is declared like this in main: public class Controle { public…
-
3
votes2
answers2511
viewsHow to add item in array through a foreach?
I’m doing a check in a directory where I list all items with a specific extension. And I need to add the items into one array through a foreach. Follow part of the code I’ve tried. DirectoryInfo di…
-
3
votes1
answer70
viewsArray items related to adding new item
I own a array that has 10 items, for example: var array_exemplo = ["item_1", "item_2", "item_3", "item_4", "item_5", "item_6", "item_7", "item_8", "item_9", "item_10"]; And, in my html, I have…
-
3
votes3
answers468
viewsSearch for word in the first array column
How do I search for a word in all lines, but only in the first column of a array that will always increase in size? string[,] array = new string[1,6]{{"texto","","","","",""}};…
-
3
votes3
answers499
viewsHow to force the reading of all existing REST results on a page?
foreach ($result as $indices) { // Aqui ele retorna 50 registros por conuslta echo $indices['Empreendimento']; // Provavelmente preciso de um loop da paginação aqui dentro // para falar para o…
-
3
votes2
answers190
viewssimpels problem with Vector and Structs
Hi, I’d like to know why you’re not going, I’ve searched a lot of places but I can’t find in C #include <stdio.h> typedef struct ficha_pessoal{ int idade; char sexo; int CPF [11]; int CPFc…
-
3
votes1
answer475
viewsJSON array with Angularjs checkbox
I am trying to form a JSON with what is selected by checkbox, but when I select it inserts, but when I try to remove the check in, it inserts again. The correct would be to work in that way, but…
-
3
votes2
answers75
viewsWhat do increment operators do in arrays?
Accidentally I was creating a PHP script and unintentionally put an increment operator in a variable whose type is array. To my surprise, no error was shown by PHP. I did some tests and found that…
-
3
votes1
answer1918
viewsAdd objects to the array
I got the dao down: <?php class CarrinhoDao { private $carrinhoDao = Array(); public function __construct() { } public function insereProduto($_produto) { $carrinhoDao[] = $_produto; print…
-
3
votes3
answers155
viewsAccess a property’s value through a String
Suppose I have the following object: var pessoa = { nome: "João", animais: { cachorro: "Rex", gato: "Pipoca", } } I need a function to do something like this: var gatoDoJoao =…
-
3
votes2
answers9108
viewsHow to insert multiple values into an array?
A student can take several courses such as "English", "Portuguese" etc. How do I put multiple course names in one array? I don’t want to set an example with ArrayList. It’s just to take a question…
-
3
votes3
answers104
viewsAbout inserting names into an array. The user puts the course name as argument in the method
I have this method: public void inserirCurso(String nome){ System.out.println(" Cadastre seus cursos aqui."); for(int totalCursos = 0; totalCursos < cursos.length; totalCursos++){…
-
3
votes1
answer217
viewsUpload mysql query to list
I am making a query in a database that returns a list of users, which I am printing in a table. I would like to turn this query into a list and then insert these users into another table This is how…
-
3
votes1
answer343
viewsCheck if an element of an array is contained in each element of another array with php
I have two arrays, I need to take each element of the second array and check if it is contained in any element of the first array using, for example, the strpos function(). I mean, I need to check…
-
3
votes7
answers874
viewsExtract Array content for PHP variables
I have a Curl statement that invokes a WS. The answer to this WS is saved via: $reference = var_dump(json_decode($exec, true)); return $reference; Since I have this in one function, in the other…