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
votes2
answers1121
viewsReceiving an array as a parameter in a PHP function
Well, the subject may be old, but that doubt has arisen, not patience in rewriting the code... The following code is not generating a result. There’s a function that’s basically like this: function…
-
-1
votes1
answer157
viewsGetting id and name of an array
I’m getting a response from my API which is an array containing some information between them idTipoTitulo and nome it occurs that I only need these two attributes to display on the screen. My…
-
-1
votes2
answers103
viewsManipulating array values in PHP
I’m storing an array in a Session, but I’m not able to manipulate it. How do I add all the values of the array? I tried this way: $item = $_SESSION['item']; $total = 0; foreach($item as $x) { $total…
-
-1
votes2
answers1993
viewsHow to get the values inside an array?
0 => {#557 ▼ +"nis": 1 } 1 => {#561 ▼ +"nis": 16192248487 } I have this array, I want to get the values: 1 and 16192248487, and plays them in a variable to give a dd and print them on the…
-
-1
votes1
answer436
viewsException in thread "AWT-Eventqueue-0" java.lang.Indexoutofboundsexception: Index: 0, Size: 0
I need to open a file txt and store his information in a ArrayList and then make a comparison between what was typed and what is in bad ArrayList to see if the login is right or not. Just follow my…
-
-1
votes3
answers5868
viewsCompare values between Array’s Javascript
Good morning, My dear, I need some guidance on comparing values between two Array’s in Javascript. I am working on small lottery simulator where the code starts with the first Array containing 6…
-
-1
votes1
answer164
viewsPass vector as argument to a function
I’m trying to pass a vector to a C function, but I don’t know what I’m doing wrong. Since the code is small, I’ll post in full: #include <stdio.h> int calcula(double A){ if(A<=10.0){…
-
-1
votes1
answer68
viewsVariable-sized Object may not be initializad
Problems in C. This error is showing: Variable-sized Object may not be initializad What to do to fix this error? Since I have already initialized everything. LINE 66, 67 and 68 #include…
-
-1
votes1
answer53
viewsI want the result of a query and SQL is simple...in PHP is confusing
I just want the result of one SELECT in php and I don’t know how to catch the result: $descricao = mysqli_query($this->conexao, "Select descricao from tabela where codigo = 1"); var_dump…
-
-1
votes2
answers161
viewsPopular PHP dropdown error with array
Hello, I have the following function that returns me the necessary data to popular my dropdown: function listaRedes($conexao){ $dados = array(); $resultado = mysqli_query($conexao, "SELECT DISTINCT…
-
-1
votes1
answer48
viewsJavascript array
People would like to know how to search an image instead of color in this javascript array below Instead: <script> array var arrDados = [{title: "Dados 1", value: 1, **color**: "#fe4400"}]…
-
-1
votes2
answers905
viewsAdd values from the same PHP array
It seems to be simple but could not, I would like to add the following array (are two arrays within one, it is divided with the array_chunk): $arr = [ [1, 2, 3, 4, 5], [6, 7, 8, 9, 0] ]; I would…
-
-1
votes2
answers631
viewshow to transform an array of arrays into a single javascript array?
Given the array: [[[1,2,3],[4,5,6]] As Transformer in: [1,2,3,4,5,6]
-
-1
votes3
answers377
viewsProblem with array in Java
I am trying to create a calendar of contacts in java, I am using some classes that were requested in the exercise. the main class: import java.util.Scanner; public class Lista15Q03 { public static…
-
-1
votes2
answers505
viewsChange the vector size during the course of the program?
I want to change the size of the vector to solve this problem "The Legend of Flavious Josephus": https://www.urionlinejudge.com.br/judge/pt/problems/view/1030 If I have 5 people with a 2 jump it…
-
-1
votes1
answer63
viewsDivision and conquest algorithms design
I need to design this algorithm using the paradigm of division and conquest (strong induction). I’m not getting out of place... Let A and B be two vectors of integers such that the total number of…
-
-1
votes1
answer61
viewsPrime numbers are not listed
I’m trying to create a C program that shows all prime numbers from 1 to 100 using brute force, but my program shows nothing on the screen. #include <stdio.h> #include <stdlib.h> int…
-
-1
votes1
answer33
viewsCreate a new array from row 2 of the array
I have an array of 30 lines and I want to get only index 1, this is the $arr[1], what I can already do. In the second line of my $arr[1], i have student information. How I do to pick up only that…
-
-1
votes2
answers294
viewsConcatenate variable with array in PHP
I have a variable nome, and a array. How to put this variable in array? Example: ['dia'].$nome; When I do this, returns error. The array dia contains a string, as an example: "Domingo", and nome the…
-
-1
votes1
answer343
viewsFill a Loop Multidimensional Array from 3 separate PHP arrays
Someone knows a way to fill a Multidimensional Array with a Loop structure from 3 separate PHP arrays? Separate arrays are in the following structure: After filling with some loop structure a single…
-
-1
votes1
answer511
viewsArray[] in database, how to create and manipulate?
I own a array of integers, a int[]. Is it possible to save it directly to the database without having to Serialize? For example: CREATE TABLE teste( numeros integer[] ); And then use SELECT numeros…
-
-1
votes1
answer1522
viewsHow to invert a character array in C?
I have to invert a vector, example: ola = Alo. #include<stdio.h> #include<string.h> #include<bits/stdc++.h> int main() { char c[5]; scanf("%s" ,c); for(int i=5; i>=-1;i--)…
-
-1
votes3
answers3540
viewsHow to receive an array and return another
I have the following question: We need a function more less that takes an array and returns another with the following three numbers: in the first position, the fraction of numbers that are positive…
-
-1
votes1
answer236
viewsDeclare a two-dimensional array in javascript with no position number specified
As you create a two-dimensional array in javascript where you don’t need to put a specific size, and it keeps growing as I add things.
-
-1
votes3
answers1056
viewsHow to convert an integer vector to an integer-only variable?
I need to convert an integer vector to a single variable, example: int teste[] = {2, 3, 5, 6}; for int result = 2356; how to do this? NOTE: I don’t have the vector size (+ - dynamic)…
-
-1
votes1
answer317
viewsHow to find the largest and smallest element of an Array/Slice in Go?
Hi, guys! I would like some help. How could I find the smallest and largest element of an Array/Slice in Go? Is there a standard library function that already does this? If not, could you show me…
-
-1
votes2
answers54
viewsSorts PHP Array Frequency
I would like to know how to order this Array, placing the repeated numbers at the end. $arr = array( 5, 4, 2, 3, 2, 1 ); sort ($arr); foreach ($arr as $n => $valor) { echo "$valor\n"; }…
-
-1
votes1
answer46
viewsAssosiative and value order
People I have an associative array and would like to sort by single input with the sum of values. For example. $product = ['Arroz branco' => 36,'Arroz parborizado' => 10, 'Arroz Integral'…
-
-1
votes1
answer49
viewsString Break for Array
I’m getting a comeback from a string from the REST API as follows: string bancos = ["BRADESCO", "ITAU", "SANTANDER"]; Only I want to make this string an array for me to iterate with the returns. How…
-
-1
votes1
answer81
viewsRead objects through the Scanner class
[![PHOTO OF THE CODE][1]][1] I am not able to instantiate an object and read it with the method of the Scanner class. It is possible to do something like? Scanner s = new Scanner (System.in); Notas…
-
-1
votes1
answer27
viewshow to read operating greater than 9
How to read an operand composed of 2 or more characters, in the code I created I go through all the string in order to identify each type of operation and number, only that I am traversing this…
-
-1
votes1
answer67
viewsHow to get the value of this Array in php?
I’m doing an Axios.post and sending an object with JSON.stringfy() In my php file I gave var_dump in the reply and $POST returns an array like this: array(1) '…
-
-1
votes1
answer48
viewsHelp with array and map
I have this code, I would like to pull all selected elements and play in an array using map, what am I missing? because it does not return anything; $('#gerar').on('click',()=>{ var selecionados…
-
-1
votes4
answers166
viewsC# WPF How to separate a long string into several positions of an Array?
I need to create a getter and a Setter for 14 Model properties that will be used to make Binding in Xaml. The properties come from here: I have a field from a database table where it loads a very…
-
-1
votes1
answer97
viewsJoin two objects in another object
Eae guys wanted to know how to pick up two objects and put everything together in a third object I speak two objects because the angular is saying that they are objects and not arrays. var obj1 =…
-
-1
votes1
answer467
viewsProblem with fscanf
Good night! I have a question in my second fscanf on the part of PATIENTS, because I wanted to save the date that appears in the text file (the day in a->h.d_day, the month in a->h.d_mes and…
-
-1
votes1
answer82
viewsErrors when defining the edges of an N x N matrix? Index: list index out of range
I created a function that takes as a parameter an Nxn matrix, and initially prints the top edge of the matrix, but I keep getting the error "Indexerror: list index out of range", and this prevents…
-
-1
votes1
answer40
viewsAlgorithm problem in C
Good afternoon, I’m trying to make a program to estimate the contagion from some parameters, but the program is not working properly, it does not create file, and has not printed any of the prints I…
-
-1
votes1
answer47
viewsSum function returns zero
By the time the input is all ok with the information, but in the output only gives the result 0 and do not know what else to do, already I moved and I reworked the whole code. The idea is that in a…
-
-1
votes1
answer109
viewsVector of large size in C
I’m studying the data types of the C language. And today I decided to create a vector of very large size, in this case, 10 8. So, I made a small code in which I declare this large vector (being that…
-
-1
votes1
answer176
viewsCall a function multiple times and return an array of objects
I am using an API that returns an array of objects according to the month. If I run the function at the current date, for example, it returns me: [{Id: 1, Title: 'X'}, {Id: 2, Title: 'Y'}] The…
-
-1
votes1
answer179
viewsSending a C++ vector to a Python function
I have the following function written in python in a file. py: def coordinate(arg): print arg return True And an example of C++ code in a file. CPP #include <Python.h> #include <vector>…
-
-1
votes4
answers500
viewsReturn array with numbers larger than the reported Javascript
I need to return with a function all the numbers of a array larger than the one reported by the user. With the function I did here it is only returning the first number of the array, and I need to…
-
-1
votes1
answer15
viewsSilver Stripe Data
How to put date in format d-m-Y with these fields? private static $summary_fields = array( 'Created', 'LastEdited', ); private static $field_labels = array( 'Created' => 'Criado', 'LastEdited'…
arrayasked 4 years, 4 months ago barbara coltro 1 -
-1
votes4
answers261
viewsGenerate 7 random dozens using javascript and loop for? How to do?
This is my code: function gerarDezenas() { var dezenas = ["d1","d2","d3","d4","d5","d6"]; for (var i = 0; i < dezenas.length; i++) { Math.random()*60 dezenas[i] = Math.round(Math.random() * 60…
-
-1
votes3
answers85
viewsPlace one array inside another
How do I add the "favorite" array to the "colors" array"? $a1['cores']=array("vermelho","amerelo","preto"); $a2['favoritas']=array("amerelo","preto"); I’ve tried with array_merge…
-
-1
votes1
answer110
views -
-1
votes1
answer22
viewsHow to iterate an array a certain number of times in PHP in Codeigniter?
I have 2 arrays, a blank( let’s call tenStatesArray) that I want to contain 10 values and another containing 26 values( let’s call statesArray). How to pass the first 10 elements of this array…
-
-1
votes1
answer110
viewswhether the number is even or odd in a single array
float vet[10]; //processamento for(x=0;x<=9;x++) { printf("\n informe o %d° número:",x+1); scanf("%f",&vet[x]); //saída de dados if (vet[x] % 2 == 0) { printf("\n O número %2.f é…
-
-1
votes2
answers284
viewsConvert pandas dataframe column with string array (Python)
I have a data frame pandas in Python, in which one of the columns is bringing the values in an array(list). I would like to remove the brackets ([]), to convert into string. I have tried with strip,…