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
-
5
votes1
answer423
viewsWhat is the use of arrays in r?
vector, matrix, data.frame and list are widely used in data analysis and tag peguntas r here in the website. In particular, I see no applicability of array in r. For example: vec_1 <- c(2:4)…
-
5
votes2
answers769
viewsHow to return values with numbers in an array
I’m trying to perform a school grade calculation with Javascript but the result returns me NaN. Code: array_notas = [10, 9, 8, 7] function calcularMedia(param) { for (let i = 0; i <= 4; i++) {…
-
5
votes3
answers2304
viewsCheck how many times a number appears in the array
I have an array with the following values: let arrey = ["1","1","1","2","2","2"]; As it is possible to check how many times the number 1 appears and how many times the number 2 appears, for example,…
-
4
votes4
answers5177
viewsHow to handle vectors in a Mysql database?
I have a supermarket box application in which after the end of the sale need to insert a record with data related to this sale in a table, in this record must be included the code of the products…
-
4
votes10
answers29077
viewsScroll through an Array and check if any element is empty
Is there a native PHP function to traverse a array and check if any element of this array is empty null? Observe the code below: if(isset($_POST['btnCriaModelo'])){ $instArray =…
-
4
votes2
answers405
viewsHow to make a constant object in Javascript
How do I declare a constant object in Javascript? For example: /* meu código */ object_teste = {valor:5} /* console navegador */ object_teste.valor=10; console.log(object_teste.valor) // aqui ele me…
-
4
votes2
answers97
viewsSubtracting matrices with different arguments
We can subtract two matrices (or two vectors) that were written with different commands? Example: x<-array(1:4,c(4,1,1)) y<-cbind(c(1:4)) x-y "Error> non-conformable objects" This means…
-
4
votes1
answer565
viewsFind in an array the next value greater than a predefined value
I have the following array with forech set: $getdepth = '{"result":"true","asks":[[20,13],[34,20],[30,8],[35,8],[4,40],"bids":[["18",22],["16",74],["70",99],["65",18],["1",15]]}'; $depth =…
-
4
votes2
answers263
viewsLooping an array to always choose the next value
I have an array of users and need to make a looping between them. It will work like this, every time someone makes a request on the page, I need to be recorded in the database the next user of what…
-
4
votes1
answer941
viewsHow to create invertible random matrices in R
One of the ways to find the estimator using the method of least ordinary squares is by generating random matrices, given by the formula: B = (X’ X)^-1 X’Y Where Y = a+bx+cw+u, being x and w random…
-
4
votes3
answers15493
viewsHow to add the results of an array brought from the PHP database?
I’m doing this, but what’s being added up is the number of lines and not the field values "something". <?php $searc= mysql_query ("SELECT algo FROM lugar") or die (mysql_error()); while ($rows =…
-
4
votes2
answers621
viewsHow do I access the indexes of a vector returned by a java method?
I have a method called vetorVoos which returns a vector of the type NodeVoo and I want to access the indexes of this vector through the method in another class. This is the method: public NodeVoo[]…
-
4
votes3
answers192
viewsHow to write an array post in current Intel - input file
Next guys, I’m adapting a file upload system to php. All the bulk has already been created, Insert and update and such, but in the middle of the logic needing a conditional to check if the input…
-
4
votes3
answers28540
viewsCreate an array with objects in Javascript
I have defined the object, and the array in the scope. //Define o array que deve ser preenchido com os objetos var itensList = []; //Define os argumentos do objeto var oItem = { Codig: 0, Desc: "",…
-
4
votes1
answer165
viewsSave table value
I would like to save the value assigned to a table in real time, I will explain. I have 2 files: Main moon. dofile("tester.lua") io.write("blabla") table.insert(oi, io.read()) print(oi[1]) io.read()…
-
4
votes4
answers15159
viewsC language - Prime numbers in vectors
I am solving exercises, in C language, on vectors. The exercise is as follows: Make a program that loads an array of 10 integers, show only the primes and their respective positions. Okay I solved…
-
4
votes1
answer946
viewsArray size
How do I get the size of an array with this structure: A = { ["b"] = {c=1, d=2}, ["e"] = {f=1, g=2}, } I want to take the size of A, in this case, 2.
-
4
votes1
answer1090
viewsNon-static variable cannot be referenced from non-static context
I’m using a context where I have an array type variable with reference to another class. When trying to declare the instantiated object of the class and declare its size is returned this error and I…
-
4
votes1
answer97
viewsIn which part of the application is it more appropriate to reorder an array (database, server application, client code)?
Suppose, in a query to the MYSQL database, I need to take the last 1000 dice released, however, within these displayed results, his order must be growing (and not decreasing, as would happen in the…
-
4
votes2
answers1267
viewsSize of an Arraylist
In Java... What is the initial size of a ArrayList? Reaching the maximum size, when it "expands", its size is doubled?
-
4
votes3
answers729
viewsPrint vector data in a struct
I want to do a birth-date registration system. The final question is: as I print the birthday: 1/12/1990, 12/2/1977, 13/09/1999 and 19/04/1987. Would be the examples of the printing of dates, but I…
-
4
votes1
answer536
viewsDisplay student grade in C
I wanted to display the student grade when all the notes were typed, in an array of 10 positions, I tried out for, but it returns me only the last. #include <stdio.h> #include <stdlib.h>…
-
4
votes1
answer1566
viewsPrint integer combinations in ascending order
"Given two nonnegative integers m and n, generate all combinations of integer size m from 0 to n-1, in ascending order. Example: m=3 and n=5 (0 1 2); (0 1 3); (0 1 4); (0 2 3); (0 2 4); (0 3 4); (1…
-
4
votes2
answers466
viewsHow to go through Arraylist with daughter class
Next, I have one ArrayList student type (which is an abstract class), and I have two daughter classes (EstudanteGraduacao and EstudantePosGraduacao), when I’ll add them to ArrayList it’s quiet, but…
-
4
votes3
answers144
viewsHow to play items with a specific value for the beginning of an array?
I have an array questions[] with the following properties: perguntas[0] = { id:1; ordem: 3; inicio: 1 }; perguntas[1] = { id:2; ordem: 2; inicio: 0 }; perguntas[2] = { id:3; ordem: 1; inicio: 1 }; I…
-
4
votes4
answers1394
viewsHow to concatenate two byte arrays in Java?
I have: byte mensagem[]; byte nonce[]; How do I concatenate the array nonce at the end of the array mensagem and store in a third array?…
-
4
votes2
answers1591
viewsWhat happens when I convert String to an array of bytes?
I have: String msg = "Texto a ser encriptado"; byte array[] = msg.getBytes(); What happens when I convert the string to an array of bytes? I’m concerned about an application I’m developing. I need…
-
4
votes1
answer870
viewsWhat is Array.Getlength for?
To know the size of a vector, I can only use the nomedovetor.Length, right? I saw an example in a structure for, where they wore GetLength(0) or GetLength(1) to capture the dimensions of a array row…
-
4
votes3
answers2948
viewsHow to add contiguous numbers from an array?
I have a array of numbers being typed by the user, and need to add the numbers of this array. import java.util.ArrayList; import java.util.Scanner; public class Questao3 { /*3.Fazer um algoritmo…
-
4
votes1
answer80
viewsWhat are the advantages of using Splfixedarray instead of an array?
What are the advantages of using Splfixedarray instead of an array? What are the advantages of fixing a value to an "array" (in PHP) ? Example with array: $arr = array(); $arr[0] = 'Stack'; $arr[1]…
-
4
votes3
answers6632
viewsHow do I know if an object is a javascript array (without jquery)?
I wonder how I can identify which object is or is not one array in Javascript. I know that in jQuery there is the function $.isArray. But I’d like to learn how to do it without the jQuery. I tried…
-
4
votes2
answers1552
viewsSQL query with array type in Postgresql
How to filter this field of type array in Postgresql? I have a table X with a field Y of the kind character varying[] with two records: {'meeting','lunch','training','presentation'}…
-
4
votes1
answer366
views -
4
votes1
answer1541
viewsSend array by GET
I’m sending by GET one array in Javascript to another page through a button calling the function. The problem is that sending is in string and not in array. I want to pass this array for the Lua…
-
4
votes2
answers260
viewsDoubt about pointers
This code creates matrix, initializes and prints, as well as adding, subtracting and multiplying matrices: typedef struct{ int nl; int nc; int **elementos; }MATRIZ; void criar_matriz (int, int,…
-
4
votes2
answers815
viewsWhy declare pointer to array if arrays are already pointers?
if an array char is already a pointer, why declare a pointer to the array? And what’s the difference between char exemplo[10] and char *exemplo[10]?
-
4
votes3
answers20750
viewsHow to add option for a select by Jquery/Javascript
I’m trying to create a select which receives its options via Javascript or jQuery, the data is stored in an array. Example: for (i = 0; i <= cidades.length; i++) {…
-
4
votes1
answer122
viewsWhy does Arrays implement Ienumerable but not Ienumerable<T>?
I was making a class that contains an Array of the class Episode: public Episode[] EpisodesList; Then I implemented the IEnumerable<T> in my class. And as expected, I implemented the method…
-
4
votes3
answers1647
viewsTake the first and last date of an array
In PHP I have this array: $locados = array('2016-01-01', '2016-01-02', '2016-01-03', '2016-01-06', '2016-01-07', '2016-01-08'); These dates within the array represent two different rentals of an…
-
4
votes2
answers185
viewsHow to pass an array as argument with the user defining the column number?
I’ll make a simple program just to illustrate my problem. #include<iostream> using namespace std; void recebeValor( int mat[][col]) // me da erro de comp; { mat[0][0] = 2; cout <<…
-
4
votes1
answer38
viewsOrderby in an array
Fellas, I’m trying to edit a array, so that it can provide me with the information in ascending or descending order. I’m doing it this way: $Recent_Page = get_post_meta(get_the_ID(),…
-
4
votes1
answer738
viewsPass List to a sub report and call it in main report
Guys I have a method that generates a pdf report in a certain directory, now arose the need to use a sub report, but I’m having difficulty understanding how to pass a List as the data source for…
-
4
votes1
answer99
viewsDoubts with Arrays in C#
Good night, you guys. I am a beginner in programming and have two questions: When a double array is maintained in C#, each position of the array starts-without as null or zero? Is there a method…
-
4
votes1
answer229
viewsSegmentation fault when accessing pointer content
I need to declare a pointer vector, which will point to types float, and make a simple reading of values. The program compiles but after typing 4 values I get a Segmentation fault (core dumped). Why…
-
4
votes3
answers408
viewsError listing items from a foreach() array
I have a array with the list of several Brazilian banks and need to take the name of the bank where the code according to what is in the user’s account, only when doing this search for code it…
-
4
votes1
answer95
viewsHelp with scroll animation with javascript
I have a vector image <img src="images/first-page/vectors/waves-723178.svg" alt="Imagem vetorial decorativa" class="vector-wave"> and it is positioned to the left of the screen .vector-wave {…
-
4
votes1
answer118
viewsPHP - Array - Horizontal Keys
Situation I own an array as follows: Array ( [1] => Array ( [tree] => Array ( [tb_agenda_hora] => 2, [tb_agenda_fase] => 1, [tb_agenda] => null ) ) [2] => Array ( [tree] =>…
-
4
votes1
answer672
viewsDelete information from a vector that is in another C++ class
Hello, I have a question regarding classes in C++, I hope someone can help me. Thanks in advance! I am developing a work for college where I need to register students, disciplines and grades and at…
-
4
votes3
answers240
viewsWorking with X-layer array in JS
I have a big problem, I have researched several places and I have not found the solution I hope you can help me... My goal is to create a JS function that will take an array as a base, which here I…
javascript jquery array multidimensional-array dynamic-programmingasked 9 years, 4 months ago MateusFMello 166 -
4
votes3
answers603
viewsProblem sorting an array with Sort()
One of them occurs when I wish to order a array number. Ex: var a = [44,7,5,6,4,2,1]; a.sort(); console.log(a); The expected result would be: [1, 2, 4, 5, 6, 7, 44], but what is always returned to…