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
answer158
viewsCompare two number arrays
I’m having a hard time making a comparison on PHP between two arrays. I have the Array HORA_INICIAL and HORA_FINAL what I need to do : In the Start Time array compare the Hora Inicial < Hora…
-
0
votes1
answer16507
viewsHow to print a string from a string array in C?
I have a string vector(palavras[x][y]), I can read every word that will be an element of the vector, but I cannot print any of these stored words. printf("%s",palavras[a][b]), doesn’t work. Here are…
-
0
votes2
answers121
viewsI can’t remember some concepts about class arrays
I’m wondering. 1 - Is my reasoning correct? For example, if I put Funcionário funcionario within the class Empresa, means that: "In the company has employee". Correct? 2 - How do I define a class…
-
0
votes2
answers240
viewsConcatenate items into a vector
I have the following vector, which I obtain after consulting a database: a = ['[[10, 20], 10]'] When I try to access their values through the indexes, I can’t. For example, if you type:…
-
0
votes1
answer56
viewsArray that is turning into object
When using the json Decode function on a json, I’m having a problem. When the numbering is perfectly in order(0,1,2,3...) it is classified as arra: [2016-08-01] => Array ( [0] => 07:00:00 [1]…
-
0
votes1
answer408
viewsmounting an array with php for p phpmailer
Guys I’m trying to set up an array with the list of e-mail addresses, so that phpmailer send them. However I’m having problems. No error is displayed, php simply does not send the emails. I’m…
-
0
votes2
answers117
viewsSave phrase in Textview when closing the app
I have many phrases that will be displayed in a Textview, while I’m clicking on the button will appear new phrases, I wonder if the phrase that is in the Indice 0, when you click it goes to Indice…
-
0
votes2
answers234
viewsHow to read a string within an array?
I would like to read a varchar field in a Mysql database, which contains several dates in the following format: "20171012 20171102 20171115 20171120 20171225" all into an array of the type, like…
-
0
votes1
answer88
viewsIs there a website or PDF with exercises for handling arrays?
I wanted to know if you know any site or have Pdfs or anything else that has exercises with functions for handling arrays in PHP. I went to Sopt, because I searched a lot on the internet and I…
-
0
votes0
answers179
viewsCompare values of a multidimensional array in php
I have the following array I need to generate confrontations between them aletorios and the teams of the same array Ex. Santos and São Paulo cannot face each other!! array(5) { [1]=> array(2) {…
-
0
votes1
answer563
viewsHow do I not print repeat numbers?
How do I not print the repeated numbers ? I saw some examples on the internet but they were something very complex in which I didn’t understand anything :x #include <stdio.h> int main (){ int…
-
0
votes2
answers554
viewsWhat are the applications of day-to-day arrays? (examples of their usability)
I did a search on the internet about the use of arrays and found many results aimed at creating games just... But aside from this example, where I use more arrays (matrices) in everyday life…
-
0
votes1
answer113
views -
0
votes0
answers90
viewsArray with PHP and Postgresql
Hi, I have a problem with the feedback from the database. It’s returning me a cluttered array and with information from another bank user. Here is the Index: <?php SESSION_START(); ?>…
-
0
votes1
answer136
viewsHow not to show in the output the null positions of a vector?
How do I prevent those gigantic numbers referring to the empty positions of my vector from appearing? My code: int main(int argc, char** argv) { double notas[10]; double soma = 0, media = 0; int i,…
-
0
votes1
answer87
viewsRead a specific phrase from a file and stop at it
I want to store in a string a part of an archive: Bruno Mossa Rezende 5 2 7 6 22 22 0.13 8 19 141 0.17 260 2 320 5.42 43 22 6 0.90 0 0 0 5 of that file I want to store in a string "Bruno Mossa…
-
0
votes1
answer71
viewsHow to iterate php array
I have the following block feeding an array $insert = array(); for($i = 0; $i < 2; $i++){ $insert[] = array( "os" => $cdOs, "name" => $iten->name ); } The array returns like this: array…
-
0
votes1
answer2086
viewsNumber of repeats within an array
I’m trying to count how many times an element appears within an array. ` public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] array = new int[4]; int a; for(int i =…
-
0
votes1
answer575
viewsI would like to check in the customer register if the code entered already exists. How do I?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AtFinal { class Program …
-
0
votes2
answers66
viewsSize of arrays
If the theory says that the size of an array cannot be changed, only the elements. Because when I print the size of a the value is 10 and not 5 or 15? int[] a; a = new int[5]; a = new int[10];…
-
0
votes0
answers176
viewsHow to divide two values of an array?
I have the following code, where only index 0 is string: $row[0] = $row[0]; $row[1] =(float) $row[1]; $row[2] =(float) $row[2]; $row[3] =(float) $row[3]; $row[4] =(float) $row[4]; $row[5] =(float)…
-
0
votes1
answer403
viewsCompare values of several arrays contained in a PHP array
<?php $productos = array( 'producto1' => array( 'preco'=> 25, 'quantidade' => 5 ), 'producto2' => array( 'preco'=> 20, 'quantidade' => 50 ), 'producto3' => array(…
-
0
votes0
answers64
views -
0
votes1
answer106
viewsHow to separate values from a json answer and add their results?
I have the following reply from AJAX: [{"valor":"100","dt_month":"11"}, {"valor":"150","dt_month":"11"}, {"valor":"1324.50","dt_month":"9"}, {"valor":"12.35","dt_month":"5"}]` I would like to…
-
0
votes1
answer34
viewsArrays not initialized
After the statement int[ ] a; what is stored in the variable a? null or an undefined value, where a cannot be used until something is assigned to it?…
-
0
votes1
answer96
viewsPuzzle with array and modal
So I have a page that shows a total of 8 Divs per pagination, these Divs have little information inside, they have 2 button that allows you to delete and have more information about what is inside…
-
0
votes0
answers32
viewsDoubt about Fibonacci series
Why didn’t my code print the first 300 numbers in the Fibonacci series and start finding negative numbers? What’s the problem with this code? Because he only goes up to 92? final int ARRAY_SIZE =…
-
0
votes2
answers129
viewsName as number in Array foreach
I have this foreach below that lists results of a Select, I would like to name according to the number, as I did below in IF, but it hasn’t worked yet.. foreach($result as $row) { $segurado[] =…
-
0
votes1
answer400
viewsUpload PHP and Mysql image array
I have the following code: <?php if(isset($_FILES['files'])){ $errors = array(); foreach ($_FILES['files']['tmp_name'] as $key => $tmp_name){ $file_name = $key.$_FILES['files']['name'][$key];…
-
0
votes2
answers67
viewsProblem in the printing of a vector
Guys I’m having a basic problem that I can’t understand the mistake: Prova Class: public class Prova { public static void main(String[] args) { Vetor lista = new Vetor(); Scanner scan = new…
-
0
votes0
answers54
viewsHow do I match a value of an array with another value in another array in Java?
I know how to get the value of an array position and compare the array values. As code below. for (int i = 0; i < listadosWifi.size(); i++) { /* pega o SSID e o BSSID */ providerName =…
-
0
votes3
answers16701
viewsThe ' ' (SPACE) character, counts in the string in the C language?
For example, it will only save the first letters before the space array, why ? Does anyone know how to explain ? #include <stdio.h> int main(void){ char nome[20]; printf("Digite seu nome: ");…
-
0
votes1
answer69
viewsHow do I get PDO to list Array with Correct Types?
In Mysql save data to a table by setting some fields as int or float, but when I make a select in the database via PDO array Everything comes as a string. Has some function that forces you to return…
-
0
votes1
answer192
viewsPHP - How to navigate a radios array?
I have the following code: <?php while($row = mysql_fetch_array($alunosTurma)){ ?> <tr> <td><?php echo $row['NM_NIS_ALU']; ?></td> <td><?php echo…
-
0
votes1
answer51
viewsOperating array elements
It is possible to operate elements of an array in Javascript without the need to use a repetition structure as for or while. For example, suppose I have an array with 10 elements and wish to take…
-
0
votes1
answer271
viewsArray returning error "Can’t use Function Return value in write context in"
I’m creating a array but it is returning me the error: Fatal error: Can’t use Function Return value in write context in C: xampp htdocs cadastro_insert.php on line 54: Where am I going wrong???…
-
0
votes1
answer14069
viewsHow can you count repeated numbers in a vector?
I’m wondering if there are how many repeated values in the vector. Here’s the code I tried, but I didn’t succeed. #include <stdio.h> int main(int argc, char** argv) { int a, i, j, c = 0;…
-
0
votes1
answer160
viewsQuestion about row in C
Can someone analyze my code and see what might be wrong?. It’s a simulation exercise I got to do in college. Error: Code runs, but loops. Which while has a problem? Code: #include <stdio.h>…
-
0
votes1
answer524
views -
0
votes1
answer190
viewsHow to transform a JSON that contains an object array into an object list?
Good evening. I have the following JSON: { "_id": { "$oid": "3432fa43242" }, "posts": [{ "thread": { "uuid": "2911da", "url": "http://www.google.com", "site_full": "opiniaoenoticia.com.br", "site":…
-
0
votes0
answers69
viewsJoin array to Json output
Hello, I’m having doubts how could I join this 4 array’s with the relationship between them. I have the page hierarchy -> post -> comments -> reply. I need to associate the posts to the…
-
0
votes1
answer56
viewsWorking with arrays and conditions
I have three arrays received via POST: [campo_habilita] => Array ( [0] => Habilitado [1] => Habilitado [2] => Habilitado ) [campo_nome] => Array ( [0] => Nome 1 [1] => Nome 2…
-
0
votes1
answer36
viewsHow to Capture This Array
I’m trying to make a API. This is my code: require('conexao/conexao.php'); $jsonObj= array(); $query="SELECT * FROM filmes"; $sql = mysql_query($query)or die(mysql_error()); while($data =…
-
0
votes2
answers719
viewsHow do you put this in the ascending order?
<?php $var = 5; for ($i = 0; $i <= $var-1; $i++) { $new_data = array($i => $count[$i]["rank"]); foreach ($new_data as $i => $key) { print(var_export($key).","); } } ?> he returns it:…
-
0
votes1
answer130
viewsMove array item to last position!
People need to move an item from an array to the last position of it! First I ordered it in altabetica order, but an item needs to be the last on the list, how can I do this with PHP ? I have the…
-
0
votes1
answer110
viewsHow to stop printing positions = 0 of a vector?
In the example below, how I would fail to print the positions of this vector that are equal to 0 int[] caluculo = {50,6,0,59,6,7,0,6,8}; for(int i = 0 ; i < 9 ; i++) {…
-
0
votes1
answer287
viewsStructure Array coming from mysql with PDO (organize)
Good evening, I’m having a hard time with arrays where I’d like them to stay in order so I can use them as follows. In my database I have many images that I call them with this code below. <?php…
-
0
votes2
answers90
viewsError trying to scan an array
I am trying to scan the array within the loop, as per the code below: import java.util.Scanner; public class RapidoPora { public static void main(String[] args) { int[] nota = new int[10]; for(int c…
-
0
votes1
answer93
viewsDisplay value of an object item using Javascript
I’m a beginner in Javascript, I don’t know how to display the value qtdeEstoque of listaTamanhos. Can someone help me? alert("Tamanho: " + lista.Value + " / Estoque: " + data[i].qtdeEstoque);…
-
0
votes1
answer79
viewsAllocate space to a double vector vector vector
I’m trying to allocate space in memory for a double vector vector vector. I know that for a vector vector I can do vector<vector<double>> Vetor(51, vector<double>(47, 1)) And this…