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
-
1
votes3
answers116
viewsWhy is it not possible to assign a string vector after being declared a character?
char vetor[10]; vetor = 10 /*ERROR*/ Why does this happen? It has to do with vectors being composed?
-
1
votes6
answers9622
viewsTransform json array into php array
Well, I have a little problem that I haven’t been able to solve. I already Googled about it, and the solutions I found did not suit my problem. I need to transform the array "Players" that is in…
-
1
votes1
answer222
viewsMultiple Keys/values in a javascript array
in certain part of my code I need to make a request using javascript with several equal ids. The problem is that it is overwriting the ids with the last selected. My Html: <button class="btn…
-
1
votes1
answer79
viewsCreate the same function in php
I have the following function in javaScript: function teste(ctrl) { var str = ctrl.value; var str = str.split(" "); if (str.every(isBigEnough) && str.length >= 2) { alert(true); } else {…
-
1
votes2
answers691
viewsHow to avoid "Warning: ISO C++ forbids variable length array ːfilename' [-Wvla]" error in C++11
I have the following piece of code that aims to create a buffer for the file name that will be created based on some information provided at class instantiation: char fileName[size];…
-
1
votes2
answers675
viewsHow to organize an Array in Date order?
I am wanting to organize an array by Crescent date order. I was thinking of cutting the parts using the bar (/) and compare with the other parts, but I don’t know if it’s the best way to do it. I…
-
1
votes3
answers1407
viewsHow to transform an Object Array into a Simple Array? Javascript
I wanted to know how I can transform an Object Array to a Simple Array with only a certain vaor.. I have this: const names = [ {id:0, name:"Jean"}, {id:2, name:"Ricardo"}, {id:4, name:"Letiiicia"},…
-
1
votes1
answer64
viewsDoubt about PHP array
I’m having a question about separating a content from a text file and separating by array. For example, I have the following texts: TEXTO1 <head> <edic><Diário Gaúcho…
-
1
votes3
answers235
viewsarrays equality in Java Script
Good afternoon, I have this little program: let oi=[1,2,3,4] let xau=[] xau=oi xau[2]=7 console.log(oi) my problem is that when on the console the impression that comes out is: [1,2,7,4] according…
-
1
votes1
answer41
viewsFitrar array PHP
I have a PHP array, as illustrated below. I know I can filter them through (foreach, for example) and seeing if a value meets a certain criterion. But there is some simpler and faster way to make…
-
1
votes1
answer1517
viewsVBA - Popular array string and do not repeat values
I have an Excel Workbook x. This Workbook has 3 spreadsheets. The 1st is Animals still empty; the 2nd is Birds and we have repeated values and the 3rd is Mammals also with repeated values. How to…
-
1
votes0
answers61
viewsHow to verify the existence of a given array in another array?
At a certain point in my system, I need to consume a method that returns an array, which can contain arrays. I need to feed a second array with data contained in array leading. See example?…
-
1
votes1
answer120
viewsAs I give echo in array
public static function getAllCount(){ $sql = "SELECT COUNT(Title) from ".self::$tablename." GROUP BY category_id"; $query = Executor::doit($sql); return Model::many($query[0],new EventData()); }…
-
1
votes1
answer230
viewsStore input values in Java
I need to store values with more than one entry. If a program requests 10 entries, should I store them in 10 variables? In this case the entries are of the type Int.
-
1
votes1
answer88
viewsStoring in a vector without pressing ENTER at each insertion
It is necessary to store a sequence of numbers in a vector, but pressing ENTER only at the end of the line. For example: ENTRADA: 10 20 30 15 50 <ENTER> Vetor[] = {10, 20, 30, 15, 50}…
-
1
votes4
answers381
viewsTransform Multiple arrays into an array only
In certain process of my system, I receive as return of a function a array of characteristics and that array may contain various information, including other information arrays with different names…
-
1
votes1
answer2803
viewsCompare a char vector?
Good staff I have the following doubt why I can’t compare two char vectors using relational operators ? I know that vectors are a composite type and that the characters are in a static area I’m sure…
-
1
votes0
answers93
viewsHow to add a comma to each loop string by omitting only the last string?
I have a loop that is generating several names, but need the result of this loop is merged into only one string and names are separated by commas, but omitting the comma in the last name. Expected…
-
1
votes2
answers1722
viewsSQL query with PHP array
I have an array that will be variable, e.g.: $ref = array('123', '654', '555'). I wanted to make an SQL query to bring the information of these references, something like: SELECT * FROM tabela_itens…
-
1
votes2
answers73
viewstaking out the commas and sorting with php mysql
I have a problem here to solve... I take from the bank the numbers that are grouped with comma. Split with explode Ex: $dados = "36,38,40,42"; $separar = explode(",",$dados); $result = $separar[0];…
arrayasked 6 years, 6 months ago André Monjardim 31 -
1
votes1
answer772
viewsplace table elements in a list
I have an empty table , and then a javascript code that allows you to fill the table through input. What I want is to put all the information of this table in an array (depending on the number of…
-
1
votes0
answers55
viewsArray with random indices
I have a random array that returns several keys and I need to manipulate all the returned data, the problem is that they vary depending on the occasion, I want to display this organized information…
-
1
votes2
answers1540
viewsTransforming vectors into a Matrix
I have several signals, where S1, s2 until Sn, are vectors of size n, I would like to unite them in a matrix to stay as follows: matriz = ( [s1] [s2] ... [sn] ) So that I can access an element at…
-
1
votes1
answer74
viewsCould you help me with Mergesort?
I’m having trouble compiling the Mergesort sorting method. #include <stdio.h> #define TAM 10 void intercalar(int vet[],int aux[],int ini1, int ini2,int fim2) { int…
-
1
votes2
answers263
viewsHow to avoid array overflow in C++?
My show was exhibiting some weird behavior, until I found out that there was a bang of array, for example: int arr[3]; for (int i = 0; i<10; i++) { arr[i]=i; cout << arr[i]; } In this clear…
-
1
votes2
answers163
viewsConverting a vector<struct> to C++ into C
I am trying to adapt a C++ function into pure C. I have changed the variable names and structs because it’s beside the point. typedef struct struct1 { int a; int b; int c; string d; } STRUCT1;…
-
1
votes0
answers68
viewsArray is not being created correctly
I have a variable from AngularJS which saves any json I upload, the json data is similar to that: { "Products": "Pimenta Vermelha muito boa", "Product_Code": "XXXXX", "RTV": "Alisson Acioli",…
-
1
votes2
answers209
viewsOrganize multidimensional array in javascript, preventing the next item from having the same type as the previous one
I have a logic problem here. Let’s see if you can help, because I’m burning neurons here and I haven’t found a starting point. I have an array of objects and need to organize it in a way that the…
-
1
votes1
answer242
viewsHow to return to the beginning of a C#Array
I have to develop a code where he does the Cesar Cipher encryption, the characters I should use should be in this sequence; A~Z,(blank space),0~9. I’ve developed most of the code, only I ran into a…
-
1
votes1
answer183
viewsTwo php foreachs - Duplicate data
I have two selects that return me two arrays and I need to go through them, in the same table, but the records are being duplicated. How can I best resolve this issue ? Follow the example: <?php…
-
1
votes1
answer1050
viewsHelp to populate an array with objects using a while
I want to read lines from an SQL and use them to create objects and finally put these objects in an array. But at the end my methods (from the Object class) do not print the object name. The code to…
-
1
votes2
answers258
viewsUse of struct in C#
I have to record customer information. And I used struct to do this. Is it worth doing this? It is or is not a good practice?…
-
1
votes1
answer80
viewsBringing Query and Multidimensional Array
I have the need to create an array more or less like in the code below: $documento = array(); $campo = array(); array_push($documento, "1", "CPF"); array_push($campo, "1", "Nº CPF",…
-
1
votes1
answer133
viewsRandom ads with view counter
I’m with the following script to put random ads on the site, besides simple and easy also works really well and fast with various ads. The problem is this: How many times each ad was chosen by this…
-
1
votes1
answer272
viewsHow to start an array with the value the user type is possible?
If all allocated memory is defined at the time of compilation, then how is this possible: int num{0}; cin >> num; int array[num]; From what I understand, this could only be possible if using…
array c++ memory-management allocation variable-declarationasked 6 years, 5 months ago silash35 483 -
1
votes1
answer63
viewsI cannot print an array with foreach
I cannot print my array when I put a different key, it gives the error Warning: Invalid argument supplied for foreach(), how to proceed? for ($i=0; $i < 2; $i++) { $use[$i]['outrachave'] = 'some…
-
1
votes1
answer8780
views -
1
votes3
answers1041
viewsSort sequence of numbers from a TXT file
I have a TXT file with numbers separated by spaces and I want to sequence from the smallest number to the largest, just the numbers from the first line of that file. The logic of sequencing I…
-
1
votes1
answer1315
viewsTransform object into array keeping the index
Good afternoon Friends who can help me? I have this Object Array, I needed to turn this Object into a list more keeping the Input as it is Using Map it changes the Dice: I needed then to access each…
-
1
votes2
answers357
viewsConcatenating the elements of an array
I have an array in Javascript: var array_soma = [ "parte 1", "parte 2", "parte 3", "parte 4", ]; I would like to concatenate each element for the array to look like this: var array_soma = [ "parte…
-
1
votes1
answer599
viewstransform string into javascript array
Good afternoon, have the following string [{"programa":"teste"},{"programa":"Aprender"},{"programa":"outro teste","indice":"0;1;0"}][{"programa":"Programando…
-
1
votes1
answer851
viewsArray counter with while in JS
I need to count the elements of a array using the loop while and display in a alert(), but is not exhibiting in the browser the count number. Using for worked out. I leave my code below: var deuses…
-
1
votes1
answer100
viewsProblem to split variables in PHP
I’m having trouble with a php page. Whenever I put the following code to do the division of two variables stored in arrays $dj_cv_at[percentual][$i] = ($dj_cv_at[concluida_c_imp_total][$i] /…
-
1
votes1
answer374
viewsHow to create nested array from information received via POST
Given the array below: $aDup = array( array('35342-1','2016-06-20','300.00'), array('35342-2','2016-07-20','300.00'), array('35342-3','2016-08-20','300.00'), array('35342-4','2016-09-20','300.00')…
-
1
votes2
answers219
viewsC# - Initialization of an array/list
I wonder if you can instantiate a vector of size n and initialize it with a specific value. (Without using one for this) For example, I would like to instantiate a vector, which will have size 100…
-
1
votes2
answers1547
viewsInsert data from an array into a mysql database
I get a json from an android application. This json is a java class that has been converted with Gson from java to a string. After the php web server receives this json I convert it to an array. I…
-
1
votes1
answer504
viewsextract data from a json
I got the following JSON: [{ "ItensReceitaModel": [{ "t0081_id_receita_itens": 1, "t0081_lote": "1233" }, { "t0081_id_receita_itens": 2, "t0081_lote": "123" }], "PacienteModel": { "t0031_id_pessoa":…
-
1
votes1
answer307
viewsHelp with login system
I’m setting up a login system. But I can’t validate the password entered. When I try this way it accuses wrong login/password. But I’ve made sure, the login and password are correct: <?php…
-
1
votes1
answer80
viewsReading array with php
good afternoon, I have this array coming from variables $form Array ( [nome] => 765hygfy [data_nascimento] => ftyftyf [email] => [email protected] [sexo] => Feminino [rg] => ytfytfyt…
-
1
votes2
answers188
viewsreverse push order
I’m using the push in a request to put a new element in a list, but I noticed that the push puts the last result down there. I want to reverse that. I’m using v-for to list, but I believe that the…