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
answer38
viewsArray of objects in php, objects being overwritten, why?
I created a helper to organize the menus returned from the database in a way that is similar to a return of a native method of the framework I am using. The code snippet containing the error is…
-
0
votes1
answer117
viewsHow to convert a Jsonarray to a Strings array?
String mensao = "[\"brega_falcao\",\"SamiPietikainen\",\"TecRahul\",\"gpantuza\",\"mkyong\",\"mkyong\",\"YouTube\"]"; Mensao is the Jsonarray I want to convert. I tried that but it didn’t work:…
-
0
votes0
answers45
viewsHow could I arrange this code for it to print the numbers of the vector increasingly?
//Questão 4 #include <stdio.h> #define TAM 10 int main() { int i, valorVET, VET[TAM]; printf("Digite os 10 numeros:\n"); for(i = 0; i < TAM; i++) { scanf("%d", &VET[i]); } for(i = TAM -…
-
0
votes1
answer746
viewsInvalid argument supplied for foreach() - Array
Good morning. I’m trying to consume a json in PHP but I’m having this problem: Warning: Invalid argument supplied for foreach() in D: xampp htdocs api consumir index.php on line 7 Array Code - JSON…
-
0
votes1
answer57
viewsWrong output in C
I’m doing an activity and the result is giving some values that I don’t assign anywhere in the code. int main(){ int numeroDePessoas = 0, tarefa = 0; scanf("%d %d", &tarefa,…
-
0
votes2
answers88
viewsJoin 2 arrays
I have two arrays $pessoas = 1 => "ERICA GRELLERT" 2 => "IARA BEATRIZ" 3 => "DANIELLE" 4 => "MARIANA" 5 => "ALESSANDRA" 6 => "EDUARDO" 7 => "DIEGO" 8 => "ROBERTA" 9 =>…
-
0
votes2
answers376
viewsFilter with Typescript
I have the following code : search(evento){ this.str = evento.target.value; console.log('str ',this.str) this.cartoes.forEach(element => { if(element.codigo.search(this.str) !== -1 &&…
-
0
votes1
answer25
viewsJavascript, fails to "save" array ordering
Failed to "save" array ordering I created a code to sort an array and store its values in a second array, but when I sort it again it modifies the value assigned to the second array and instead of…
-
0
votes2
answers417
viewsDynamic background URL
It is possible to create a dynamic array of images and call them within the background-image:url() ? With the tip that was passed by @hugocsl earlier, I would like to reuse this instruction line…
-
0
votes1
answer79
viewsJavascript array showing duplicate values
I’m making a very basic registration code in Javascript. However, after I register my data and save inside the vector and show them, the data comes out duplicated. If I type Code: 1 Name: 1 and…
-
0
votes0
answers35
viewsDoes Javascript reference when it comes to assigning an array to another variable of the same type?
I would like to ask a question about a problem I’m having (I apologize if somewhere has the answer, is that I haven’t found and so I’m posting). Introducing I want to display some chekcBoxes already…
-
0
votes1
answer54
viewsGenerate a sentence list sorted by the js arraySort()
I am trying to create a list of phrases sorted alphabetically using the JS arraySort(), but using the code below, returns a duplicate phrase. Any idea how to do it differently? //Cria lista de…
-
0
votes2
answers127
viewsCombine alternative array with query array php/jquery
My doubt is the following: I have this code jquery where I capture all the questions of a proof and just below the alternatives of it; but I can’t relate the alternatives to the questions, someone…
-
0
votes2
answers1061
viewsRemove element from a Vector in "C"
I must fill two vectors, A and B, with 10 elements each, then do the Interseccao and the Union, in the union, I must remove the repeated elements. At the time, the intersection was made, within the…
-
0
votes1
answer7113
viewsEliminate repeated elements of a vector in C
I have to make an algorithm in C that takes user values and armzazena in 2 different vectors (X and Y) and then shows the union (all elements of X and Y without repetitions), the difference (all…
-
0
votes1
answer98
viewschar and constructors in c++
I need a constructor for a class that has char vectors as attributes, like this one: class Anthem { private: int Id; char Name[50]; char Country[50]; int Year; char Composer[30]; char Historic[200];…
-
0
votes2
answers38
viewsProgram with Warning and does not perform what was requested
Good night! When I was studying for the test I’m going to take, I faced that question. However, when I performed the program, I did not realize what I did. I would like you to see my code in order…
-
0
votes1
answer50
viewsFilling missing result index of a select with 0
I make a select in the database from which I get a array data. With this, I do the following foreach in the same: foreach ($resultado4 as $key => $value7) { $array6[$value7['carteira'].'flores']…
-
0
votes1
answer46
viewsGroup values in a Mysql PHP query
I am pulling values BD for a table with the results of the query, this search is by date, is working perfectly if I search for a single day, but I would like when to search for two or more days (ex…
-
0
votes1
answer222
viewsGroup, assign, and sort values from a multidimensional array in PHP
Hello, everyone. I have the following multidimensional array in PHP: Array ( [0] => Array ( [0] => teste0 [1] => 1 ) [1] => Array ( [0] => teste1 [1] => 1 ) [2] => Array ( [0]…
-
0
votes2
answers36
viewsError wordpress plugin, ie blank field in array
good night! I’m developing a website for a restaurant and in it I installed a desktop reservation systems plugin, called (https://br.wordpress.org/plugins/restaurant-reservations/) The following…
-
0
votes1
answer149
viewsAdd PHP multidimensional array
Good morning, I have the following array: Array ( [0] => Array( [data] => 2018-06-08 [grupo] => 1 [maq] => 1 [segundos] => 10089 ) [1] => Array ( [data] => 2018-06-08 [grupo]…
-
0
votes1
answer323
viewsHow to compare two vectors and exclude equal values from the vector with the highest number of characters? In "C"
Generate and display sets A - B and B - A A and B are both vectors with user-defined sizes A -- allele values B -- user defined for example: vector A= (10),(5),(7),(8),(12) vector B= (10),(8) A-B…
-
0
votes0
answers225
viewsInsert at the beginning of a circular row
I am working on a circular queue program where I want to implement a "queue break" function, where the user inserts a number and this number should be inserted in the queue spaces prior to f.com.…
-
0
votes1
answer233
viewsOrganize array
Good how I can organize this array without using a loop Original array ["Entrada" => 4, "Prato principal" => 1] Desired array [["Entrada",4],["Prato principal",1]] ok I understood what you…
-
0
votes1
answer73
viewsHow to take a value inside an array with PP
I have an API with some information and I want to get the Genre: Samba/Pagode stdClass Object ( [id] => 46484422 [title] => Raça Negra e Amigos II (Ao Vivo) [upc] => 7891430177379 [link]…
-
0
votes1
answer1321
viewsAngular 5 , Mapping an array of Objects within another array of Objects
Well I’m trying to encapsulate my objects. The first Object it maps the first JSON array. export interface PraticarObject { id_assunto: number; nome_assunto: string; qt_exercicios_concluidos:…
-
0
votes1
answer186
viewsProblem splitting a String array into C
I’m making a program that needs you to find half a string vector, but that half cannot cut any word, so that half would necessarily have to be the next space found after half. Soon after finding…
-
0
votes1
answer61
viewsList BLOG and show on the same page the chosen ARTICLE
I am working with PHP and use friendly URL. By clicking on the link <a class="nav-link" href="<?php echo URL::getBase(); ?>blog" tabindex="12">blog</a>, my URL gets:…
-
0
votes1
answer27
viewsI can’t go to the Page
Hello, here I am with one more question. I created a project on Ionic 3, and I have this profile menu , but when I click on each menu item , ( Cultural agenda, by region, blog..) does not open the…
-
0
votes1
answer615
viewsMean between vectors within functions (python)
Good afternoon guys, I have the following code: def Ler_vetor(): VET= []*10 for i in range(0,10): VET.append(int(input('Digite um número: '))) return VET def Escreva_vetor(VET): print('Dentro do…
-
0
votes1
answer1497
viewsHow to edit data from a Struct using a function
I want to create an edit function that takes as a parameter the music array by reference. (using pointers) The user must choose the song number and type back the data from that vector position. I…
-
0
votes0
answers45
viewsHow to extract a word between , and =?
Supposing I had a word: char[1000]={"ALGUMA COISA,ALGO=TESTE,FIM"}; The word before = and = itself are optional in the sentence; How do I store the SOMETHING word of the phrase in a variable? The…
-
0
votes1
answer83
viewsProgramming Problem C - Vectors
The problem is: Write an algorithm that reads 3 vectors A[1..10], B[1.10] e C[1..10] and write the elements that are in A and B (intersection) but are not in C. Write the values in the order they…
-
0
votes1
answer145
viewsLooking for an item in the php XML file
I have an xml file, and I would like to bring to the page only one item of that file, in case I can bring all the items of a view only through the code <?php $feed =…
-
0
votes0
answers36
viewsFunction that returns multiple elements
I have a doubt in the following exercise: Make a subroutine that takes a single value representing seconds. This subroutine should convert it to hours, minutes and seconds. All variables should be…
-
0
votes1
answer54
viewsUnchanging collection adding strings
I’m starting java programming and I’m having a problem creating an immutable collection. Below is what I created: package br.com.estudos; import java.util.Collection; public class…
-
0
votes1
answer697
viewsGroup and add values from each group of a php array
I have the following array: array(9) { [0]=> object(stdClass)#2477 (4) { ["type"]=> string(2) "in" ["category"]=> string(24) "Tratamento Odontológico" ["value"]=> string(15)…
-
0
votes1
answer1505
viewsVector union, no repetitions in C
Follows the statement: Read two integer vectors X and Y, cadao one with 5 elements (assume the user does not report repeated elements). Calculate and show the resulting vectors in each case below:…
-
0
votes1
answer44
viewsHow to store a word within a vector larger than the word
I declared a variable char SendDataCmd[256] which will store the commands sent from the computer to the microcontroller via UART. Commands have different sizes as for example RST, ADV ON e SET…
-
0
votes0
answers99
viewsHow to separate array by columns
Good night! I’d like to ask for your help on the following... I need to read a txt, which contains information of a client x... Only this txt is separated by lines and I n can change because it is a…
-
0
votes2
answers100
viewsSave the data from the array and not your key
Galera blz..., I am editing a field to save to db, I send to Edit.ctp the following array $result = array_merge($cones->toArray(), $cda->toArray()); debug($result); //Upshot: [ (int) 0 =>…
-
0
votes0
answers51
viewsHow to compare arrays and datagridview through loops?
Good afternoon, everyone I have 7 text boxes that I made this way long[] Jornada; Jornada = new long[7]; Jornada[0] = TimeSpan.Parse(textboxjornadaseg.Text.ToString()).Ticks; Jornada[1]=…
-
0
votes1
answer130
viewsAdd values from an array with different criteria each of them
0 : {idPVI: “10”, idPV: “3”, descri: “Portuguesa”, preco: “32” } 1 : {idPVI: “10”, idPV: “3”, descri: “Portuguesa”, preco: “32”} 2 : {idPVI: “13”, idPV: “3”, descri: “Calabresa”, preco : “35”} 3 :…
-
0
votes1
answer16
viewsDelete a key from all arrays if null or empty
Array ( [0] => Array ( [Foto] => imagem.jpg [Código] => 311102 [Tipo] => Meu tipo [Cidade] => Araçatuba [Valor] => [Mais Info] => Todos juntos ) [1] => Array ( [Foto] =>…
-
0
votes1
answer54
viewsTransform string into array excluding repeated values
In PHP I made a script that takes each word of a Tring and turns them into an array, giving explodes into empty spaces. Then he eliminates the repeated words and shows each of them, like this:…
-
0
votes2
answers468
viewsConcatenation of multiple lists with Python
Good afternoon! I have a problem and need help, I am working with 3 distinct lists that should be added to a dictionary, but so I can capture all values without one overwriting the other, I need to…
-
0
votes0
answers58
viewsHow to convert a Json to PHP array
My idea is to be able to take every element of mine Json and convert to array in PHP... That’s the Json that I want to be able to do decode, then insert each{true or false} element of that same…
-
0
votes2
answers135
viewsCompare Python index independent lists
Good afternoon, I need to compare 2 lists and when a certain value in the 'name' field of the list 1 does not exist in the 'name' field of the list 2 perform some function. The way I did is…
-
0
votes1
answer940
viewsStore values in vector
I have an exercise on vetores/arraywith simple value, where I must correct a test, comparing it with the feedback and also calculate the percentage of students who reached the average. 6) Make a…