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
votes1
answer276
viewsFloating rand in C matrix
Good afternoon, I am using the Rand function to generate random numbers in a C matrix, but I can only generate integers. I would like to generate floating numbers. I did not find anything of the…
-
1
votes1
answer179
viewsMalloc does not work in C code
While trying to compile the code I get the following error messages: #include <stdio.h> #include <stdlib.h> #define OK 0 void preencherVetor(int* vetor[], int tamanho) { int indice; for…
-
1
votes2
answers87
viewsHow to pass data from select to an array
How to save the select data down to an array SqlConnection conConexao1 = clsdb.AbreBanco(); SqlCommand cmd1 = new SqlCommand("select id, tamplete1, tamplete2 from usuarios ", conConexao1);…
-
1
votes0
answers25
viewsError in moving Intel in a Javascript array
Good Afternoon, In my code, a curious detail is happening. I have a game board and when I move my piece past the cell below any other element, this one stops. I’d like to pass it on, just giving the…
-
1
votes1
answer121
viewsLimit array size on screen
I am working with data from a table, but I used some commands like numpy.set_printoptions(threshold=sys.maxsize) to try to show every array without (...) omitting some items. But now I’m willing to…
-
1
votes1
answer62
viewsEmpty vector displays the final result of the function
I am doing tests with array/vector and, as first display of the vector should be shown empty, as second, would come full. What is the problem, why it occurs ? and how can I correct ? <ul>…
-
1
votes2
answers1072
viewsHow to order Record in Delphi (similar to ORDER BY)?
I bring some bank records with a specific sorting and play into a vector of the type record. Then I need to add more items in this array keeping the initial sort. How the sort is done in the SQL the…
-
1
votes1
answer473
viewsHow to concatenate the name of a variable into C++?
Is it possible to concatenate the name of a variable into C++? Something like this: using namespace std; int main() { int casa = 10; string a = "ca"; string b = "sa"; cout << a+b <<…
-
1
votes1
answer178
viewsString tools in ruby
Suppose the following string: "acc5???7???7ss?3rr1???5". How to check if the three question marks exist (exactly three) and if they are before or after numbers that add up to more than 10? I thought…
-
1
votes2
answers223
viewsAre parameters with vectors in Java always by reference?
I am aware that, in Java, any parameter passage of an object is by reference, already with primitive types, by value. However, I was left with doubt about the common vector. I don’t mean the class…
-
1
votes1
answer248
viewsHow to access data from a subArray with Javascript
I need to access the data of a subarray via javascript, I can currently access the content of the entire array: What I need to take on the case is codigoImpressora that is inside the subarray…
-
1
votes1
answer53
viewsHow can I separate items from a sharedPreferences into an Array?
I have a question, I made a checkbox on items in a listview that when marked are stored as Sharedpreferences. So I created a button (Favorites) to access the items marked by the checkbox, but the…
-
1
votes1
answer1259
viewsStruct vector and char pointer
Why is this syntax wrong: #include <stdio.h> typedef struct { char* nome; char* numero; }Agenda; void adiciona(Agenda* reg, int i) { scanf("%s", reg[i]->nome); scanf("%s",…
-
1
votes1
answer717
viewsProblem with char returning strange characters
The intention is to replace all words toda for 0, however after X characters it starts returning strange values as can be observed in the comments. I think I’m handling the parameters wrong, but at…
-
1
votes2
answers57
viewsPrint Value of an array
Good afternoon, I want to print the value of the array entered in the getTitleIdLocation function, which I am doing wrong? Thanks in advance. <?php class Imovel { private $title; private $id;…
-
1
votes1
answer100
views -
1
votes1
answer30
viewsBug when using array_diff_key() function
Hello, I need to return the difference between two arrays, so I decided to use the native PHP function array_diff_key(), but she doesn’t return anything to me. <?php $array1 = array( 0…
-
1
votes2
answers55
viewsHow to get a value from an array property?
A VÁRIAVEL ARMAZENZA: $parcelas = DB::select("SELECT parcela_number FROM parcelas WHERE 3000 BETWEEN valor_min AND valor_max"); VAR_DUMP: array(1) { [0]=> object(stdClass)#144 (1) {…
-
1
votes2
answers970
viewsTake the data from a dynamic form and pass to an array type state
I’m trying to get the data from inputs dynamics and pass to the state (handleChange), but I can’t, because you’re only taking the values typed in the first input and when I type in the others, it…
-
1
votes1
answer84
viewsQuestion about filling arrays and functions inside arrays
insira o código aquiArrayList<Player> players = new ArrayList<Player>(); for(contador=0;contador<x;contador++){ Player p1 = new Player(); p1.setId(contador); p1.setSaldo(valorinteger…
-
1
votes0
answers35
viewsSearch Array with certain features
Hello, I am developing a very basic game with Javascript, but I came across a little thing that I could not solve so far, the question would be, I have an Array, in which I include randomly 28…
-
1
votes1
answer277
viewsHow do I save an array of quantities and sizes for a product? PHP
I have a crud where I register the product, within this register I have a modal where it is possible to inform the sizes and quantities related to the product I am registering, after this modal…
-
1
votes3
answers3098
viewsUse return of a function in another function
I have a function in Python that takes a text and returns 2 lists, one with all the words that appear and the other returns is the number of times each word appears. def frequencia(lista): conv =…
-
1
votes1
answer56
viewsHow to get a value within an array
array(3) { ["recebidos"]=> array(16) { [0]=> array(25) { ["contratante_id"]=> int(1028) ["datacadastro"]=> string(20) "2019-08-01T12:30:44Z" …
-
1
votes0
answers79
viewsHow to start an array in another class - java
I’m trying to implement the Depth first algorithm to solve a maze, like the one below, where the starting position is S and the output is E _SW______\n _WWW_W_WW\n _____W__E\n In the Mazereader…
-
1
votes1
answer52
viewsAdapt user input to array size
I created a program that generates mazes that can be solved, but now I’m not able to implement a way for the size of the generated maze to be defined by the user. The code below is ActionListener of…
-
1
votes1
answer98
viewsFunction is zeroing last vector value
#include <stdio.h> #include <stdlib.h> /** 2. Faça um programa que, a partir de um vetor de 12 posições, crie funções para: A. Digitar valores no vetor; B. Imprimir o valor somatório de…
-
1
votes2
answers1459
viewsTraverse two arrays in parallel
Want to traverse two arrays in parallel by adding : among them: Arrays NOME = ['CARLOS','JOAO','PEDRO'] IDADE ['30','25','22'] DESIRED OUTPUT CARLOS:30 JOAO:25 PEDRO:22 Trying rows = len(NOME) for i…
-
1
votes1
answer117
viewsHow do I output my array’s Indice in C?
I have a program that will check 9 numbers and tell which one is the biggest of all, and for this I am using vetor already filled with values, and I’m using a for to go through the whole vetor and…
-
1
votes2
answers574
viewsHow to consume JSON files in PHP in different ways?
This topic differs from subjects such as: "How to consume JSON in PHP"; "Extract json value in php"; "Read string json on php" or "Recover JSON in PHP" Although there is co-relation on various…
-
1
votes3
answers165
viewsNumbers smaller than the average
I need to average 20 numbers and present all the numbers below average. package pag1; import java.util.Arrays; import java.util.Scanner; public class ex2 { public static void main (String[] args){…
-
1
votes0
answers30
viewsMini Akinator - allocate line by line.txt file in vector
I am improving a code I made for a college job. A very simplified version of Akinator. Before I did everything in the main code, now I want to read the characters of a txt file. I already created…
-
1
votes3
answers431
viewsWhat is the difference between float and float[]?
I’m seeing some codes that some exercises here on the site and whenever I see something I don’t understand, I research. In the case now it was regarding the float[] , What is the real difference…
-
1
votes1
answer523
viewsHow to instantiate a vector
I’m doing a program (college work), and I’m having trouble instantiating a vector. Also he’s presenting some errors that I’m not able to solve - one of them is in the loop while, at the closing of…
-
1
votes2
answers1578
viewsHow to change position of all matrix elements by changing the row number by the column?
I tried this algorithm but the result is the same after this exchange int[,] array = new int[10,10]; for (int l = 0; l < 10; l++) for (int c = 0; c < 10; c++) { int temp = array[l, c];…
-
1
votes1
answer99
viewsHandle HTTP Request with Item Array as response
Whoa, all right, guys? Maybe this question won’t help anyone, but I don’t know but what to do, you Stackoverflow guys are my hope. Next, on the page I’m mounting, will show all the plans that an…
-
1
votes1
answer85
viewsHow to return array indices in method
Well I couldn’t find a better title for my case, I have the following function: public function select_tokens() { $sql = "SELECT * FROM `users`"; $select_tokens = Database::DB()->prepare($sql);…
-
1
votes2
answers1666
viewsHow to turn array into string with php
item 1 - How do I do that Array ( [0] => Array ( [0] => 2 [1] => 4 [2] => 5 [3] => 6 [4] => 7 [5] => 9 ....... ....... [14] => 1 ) [1] => Array ( [0] => 2 [1] => 4…
-
1
votes2
answers467
viewsHow to store and use a vector in Firebase on Android?
I have a problem developing my app that I can’t fix and I can’t find anything that would help me. Such an app was running smoothly with data stored in variables, but when including Firebase I had…
-
1
votes2
answers227
viewsExtract data from JSON as an example
I have the following object JSON which is returned after database query: { data: { act: "3 ", searchType: "2", searchData: "33014421" }, convicts: { count: 2, rows: [ { idConvict: 7 }, { idConvict:…
-
1
votes1
answer70
viewsCorrelating values in Python Arrays
I have a vector called POSITION, with the following values: position = [40.51, 30.52, 30.31] I have a vector called COORDINATES, with the following values: coordinates = [10, 20, 30, 40, 50, 60, 70,…
-
1
votes1
answer594
viewsReceive user vector in C
Hello, everyone. I need help getting an array of integers (separated by spaces) from the user. Here’s my code: #include <stdio.h> #include <stdlib.h> #include <string.h>…
-
1
votes1
answer21
viewsFind the next key of an array
I have an array that serves as a list of steps $Lista = ['a','b','c','d']; I need to find the next value after entering the current value. Example: I’m in step B I want the code to tell me the next…
-
1
votes1
answer90
viewsOperator overload = in c++
I’m having a problem implementing operator overload = in a heap class. Heap& Heap::operator=(const Heap& outro){ printf("chamei atribuição\n"); this->escreve(); Heap *h = new Heap(outro);…
-
1
votes1
answer61
viewsHow do I stop an array through a function?
I am writing a code in Unity you need to pass several values through a function, I decided to use the array in the function statement, however when I try to recover the values of the array all of…
-
1
votes1
answer378
viewsVector: Register 5 names and their heights, then show all in ascending order.
I need to register five names and their heights, then show them all in ascending order. The problem is I can only put the heights in order, the names are in the order I typed. And also I’m not able…
-
1
votes2
answers163
viewsHow to add items to an array correctly?
I’m trying to create arrays with days of the week. "Apparently" seems to work: $array_dia_da_semana = array("DOMINGO","SEGUNDA","TERÇA","QUARTA","QUINTA","SEXTA","SÁBADO");…
-
1
votes0
answers28
viewshow can I create and model a table with attributes in the database with the PDO using array?
I’ve already got this method following some examples I’ve seen around but I still don’t quite understand how I’m going to go through this array and turn the table attributes public static function…
-
1
votes2
answers42
viewsIterate indexes of a vector
I have the following vector: a = [10, 20, 30, 40...] I need to create a new list that is the subtraction of the second index by the first, the third index by the first and so on... Then the third…
-
1
votes0
answers36
viewsReduce array by key/value in javavascript
How can I reduce the array by grouping it by the key/value and the keys I receive are dynamic? Input: [ { "CORAS": "PP007" }, { "CORAS": "PP008" }, { "COREN": "PP007" }, { "COREN": "PP008" }, {…