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
answer1015
viewsHow to pass an array in HTML attributes and not to show single quotes?
Following this post I created the following html by passing arrays as an input element attribute: ... <input type="text" name="setValues[cardExpiration]" id="card_expiry" class="input-small"…
-
1
votes1
answer555
viewsSplit an array into new character limit arrays in each array
My problem is this: I have the input string: "A|BB|CCC|DDDD|EEEEE|FFFFFF|GGGGGGG". I need to split this string in "|", so that in the case divided into 6. But I need each value to enter an array of…
-
1
votes0
answers286
viewsVuejs: how to pass data from one array to another array?
I have the following problem: I have two separate lists and need to pass the selected data (checkbox) to the other list by removing the selected item and placing it in the other list (along with its…
-
1
votes1
answer99
viewsSlowness in restricted file
I have a file in php.php process that receives information in looping via jquery and makes a request to another page with Curl, this file does something around 4 to 5 thousand requests one by one,…
-
1
votes1
answer303
viewsHow to make a pointer point to NULL?
I need an element position in a dynamic vector to be empty, so I can check if I can place an element inside it later. However, the compiler does not allow it. Follow my code: MATRIZ_ESPARSA…
-
1
votes0
answers58
viewsGlobal vector with variable size - C programming
I’m trying to create a global vector whose size is defined within a function. My code got this way: struct body{ double m; double a; double n; double e; double w; double I; double W; }; struct body…
-
1
votes1
answer68
viewsImprovement and simplification of the Code
I’m in the first semester of college, and as a final project the teacher asked to make a hangman game, I already made my code but wanted to suggest improvements, or report future code problems.…
-
1
votes2
answers70
viewsfind input value does not work
I have a list that incremented dynamically with the jquery append, the list goes like this: $("#questoes").append( '<li class="questao" data-id="'+questao+'">'+ '<div class="row…
-
1
votes2
answers1254
viewsrequire_once does not work
I’m trying to give require_once in a PHP file that has a class. The File I’m trying to include in PHP with the class has only one array with configuration data, but I can’t access it properly. class…
-
1
votes2
answers572
viewsRemove duplicate array element
I have the following array: Array ( [0] => Array ( [forn_nome_fantasia] => FORNECEDOR TESTE [class_nvl4_descricao] => DESPESAS COM FRETES ) [1] => Array ( [forn_nome_fantasia] => DJ/…
-
1
votes1
answer911
viewsReceiving data from an observable
I’m having a problem using an Observable. While inside the Ngoinit method, when fetching the data, I get the array correctly and Seto in the class variable. However, when trying to access data…
-
1
votes0
answers161
viewsAdd a Document to an Array in Mongodb
This week, I started messing with Mongodb (I’ve never had much contact with any DB before) and a question just came up that I’m not able to solve(I researched, believe me). Let’s go to the following…
-
1
votes1
answer2134
viewsHow do I pass a struct vector by reference parameter?
(1) In the checar_poll function it is not printing the correct values I am reading in the ler_data function, it is printing a lot of numbers and random symbols. (2) If you solve the problem, how can…
-
1
votes2
answers113
viewsError translating structure code from C++ to C#
I’m trying to read a string of a process, I found this structure on the Internet: struct name { wchar_t nome[32]; }; I did it that way: struct name { public char[] nome = new char[32]; } And is…
-
1
votes1
answer48
viewsAssigning values to a numeric array of values a PHP query
Given the table marcas of the database teste_db (for example) | id | marca | | 1 | mercedes| | 2 | audi | | 3 | fiat | | 4 | alfa | | ...| ... | |573 | ferrari | |574 | bentley | and given an array…
-
1
votes0
answers169
viewsReturn list in an array - Webapi C#
Good guys. I need to return a list of courses linked to a particular student, this list will be consumed through the get of a Webapi. I have the classes "student", "course" and "cursoAluno" (tables…
-
1
votes1
answer132
viewssystem with CRUD
I am majoring in Systems and I am developing a system, and my difficulty is to remove an element array, because the problem in question is that when there is more than one element it removes…
-
1
votes0
answers397
viewsComparison of matrix and vector C/C++
I need to compare a user-inserted op vector with the top 10 columns of each row of a 12x12 array. for(k=0; k<10; k++){ for(i=0; i<12; i++){ for(j=0; j<10; j++){ if(op[k]==d[i][j]){ if(i==1)…
-
1
votes3
answers754
viewsJoin objects within collection of different objects
How do I "join" or concatenate an object within a collection of different objects? I’ve tried redoing but it always gives the same error. public class Prova { private String titulo; private int…
-
1
votes0
answers92
viewsStore the string size of an array
Good morning, you guys, I am trying to take the size of a string from an array to store in a variable so that I can then use an "if". I used var_dump() where I can know the size of the string but do…
-
1
votes1
answer700
viewsSave data from an array to a database
I need to record the contents of an array that returned from a Json deserilization (return of a Json with more than one level), follow the line with the method that extracts the array: Departmants…
-
1
votes1
answer66
viewsWhy doesn’t this redacted code work the same as the original?
I’ve been studying C++ for a while and I want to train by rewriting functions already done by me in C# only in C++. I wrote a simple code that computes a IV of a Hash, very simple even, calling the…
-
1
votes1
answer67
viewsPick string by format
I have an array of 1000 indexes with texts and random numbers stacked together, I need to take this text snippets that are in particular formats that contain pre-defined amounts of characters, such…
-
1
votes1
answer38
viewsExtracting array values and transforming into integers
Please anyone who can help me. The question is this, I need to extract two variables from an array and use them as an integer type to compare values between them. The code is this: $sql = "SELECT *…
-
1
votes0
answers26
viewsAdd constant to each key of an array
How to include a constant in a given array key. Example: Unchanged array: array (size=3) 0 => array (size=3) 'id' => string '1' (length=1) 'image' => string '1.jpg' (length=5) 'carro' =>…
-
1
votes3
answers2456
viewsHow to organize items from an array in alphabetical order?
I’m having a hard time organizing this array of mine: $array = []; $array[ "T3497012@CHOSTBRHDDSB@EICM_BORA@BPHS@Bamz", "T3497012@BHOSTBRHDDSB@EICM_BORA@BPHS@Bamz",…
-
1
votes2
answers62
viewsSearch Object Array value
I have following Object: let Filmes = [{ "Nome": "Harry Potter 1", "Preco": "50" }, { "Nome": "Harry Potter 2", "Preco": "60" }, { "Nome": "Harry Potter 3", "Preco": "70" }] let Cliente = ["Harry…
-
1
votes2
answers610
views -
1
votes3
answers219
viewsAdd number in array and list it
What’s the simplest way to do it with array a kind of bank where I deposit a value in a array and show the same after. My difficulty is in modifying the array, where the initial value would be 0 and…
-
1
votes5
answers12763
viewsPHP - Transforming object into array
I need to transform an object into an array to be able to traverse it and extract its data, even with you: $array = (array) $object; But the result with a var_dump($array) Here’s the thing, so I…
-
1
votes2
answers99
viewsHandler for undefined index in array
Dear experienced developers and codar art learners. I believe it is common in some system you have to check the next item of a array. For example in this case I am checking if the next one is the…
-
1
votes1
answer837
viewsreturn array(array) of a php function
I am storing the data of a database in an array in a file called php functions.: while($line = mysqli_fetch_array($execute)){ $tabela[$a][$b] = $line['Activit']; $tabela[$a][$b+1] =…
-
1
votes2
answers73
viewsHow to use forech in Wordpress using the Wp_query variable
Good morning! I’m not able to implement a forech in a database search using the native variables of wordpress, searching found something similar however is not what I need. <?php global $post;…
-
1
votes2
answers775
viewsHow to sort an Array alphabetically in PHP?
I have an nxm array which I call $tabela. This array has some inside data organized as follows: | Papel1 | Hora1 | Valor1 | Erro | B | | Papel2 | Hora2 | Valor2 | OK_Ok | A | | Papel3 | Hora3 |…
-
1
votes2
answers66
viewsHelp with Multi Array
Hello someone can help me how to create a list with php this type of array. The data comes from two tables, Categories and Products. I am using Mysql to fetch data from both tables. My tables:…
-
1
votes1
answer901
viewsHow to set values for an array attribute?
I have a java class representing an entity snack,follows below the class: public class Lanche { private String nome; private int id; private double preco; private String[] ingredientes; /*getters…
-
1
votes2
answers433
viewsPut a name depending on the array number
Let’s say I have four variables: - Porto = 1 - Benfica = 2 - Sporting = 3 - Braga = 4 I have this code that makes me a shuffle of numbers of an array called "arr". Integer[] arr = {1,2,3,4};…
-
1
votes1
answer66
viewsProblem sending arrays from one method to another using Thread in Java
I’m doing a program that simulates sending a message from the physical layer to another physical layer of the OSI (ISO reference) model of networks. My code has a method that sends "frames"…
-
1
votes1
answer64
viewsVector return problem in c++
I’m trying to make a little program to sort vector and I’m using a helper function to do this, but it’s turning me on to this error message. /media/isaque/dados/exercicios/c/scripts/estrutura de…
-
1
votes3
answers226
viewsAverage temperature in R
Have: Data Sala.1 Sala.2 Sala.3 Horas 1 02/08/2013 20.5 19.7 21.6 15:00 2 02/08/2013 19.7 18.9 20.2 15:30 3 02/08/2013 19.7 19.1 20.0 16:00 4 02/08/2013 19.7 18.8 19.8 16:30 5 02/08/2013 19.8 18.8…
-
1
votes1
answer78
viewsHow to assign a treated value in the function to my vector?
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define TAM_Min 1 #define TAM_Max 500 /* Sintese Objetivo: Classificar animais de um zoologico…
-
1
votes3
answers206
viewsDynamic Array - Android
How to create a dynamic array in this way: //Apenas um exemplo abaixo: String valor0 = "1;2;3;4;5;6;7;8;9;0"; String valor1 = "1;2;3;4;5;6;7;8;9;0"; String valor2 = "1;2;3;4;5;6;7;8;9;0"; //Um array…
-
1
votes1
answer73
viewsInsert field into table and compare if already exists, with Jquery
Good morning! I am inserting products in a table with Jquery, similar to a shopping cart, and I need to compare if the product has not already been inserted before. I tried with the code below, but…
-
1
votes2
answers155
viewsFactor Hackerrank Solution - Using Algorithms Only
I am learning to program and I am doing the hackerrank algorithm exercises. I am in the migratory exercise Birds. To access the exercise you need login access. As many do not have access, I will…
-
1
votes1
answer47
viewsSeparate values from a list of summaries in R
From the previous question How to run a looping in R and store the results of a summary in a vector have as response a list with 20 summaries with values calculated from a specified template. One of…
-
1
votes2
answers17219
viewsFunction that returns vector
How to return a vector within a function? And how do I call it in main? This Return in the case: (vector Return;) #include <conio.h> #include <stdio.h> #include <stdlib.h> float UK…
-
1
votes1
answer40
viewsError counting repeated values in an array
I’m trying to ask a question that counts the number of times each value appears on the array, which I tried, only counts a repeated number, someone could help me with logic, Example of input 8 10 8…
-
1
votes1
answer176
viewsGroup json with PHP?
How do I group a json according to a field? I have the following json: { "origem": [ { "id": 154826, "nm": "", "tp": "", "am": "", "sg": "SAO", "sq": 925 }, { "id": 2289, "nm": "", "tp": "", "am":…
-
1
votes1
answer534
viewsSelect Mysql with an array in a table
I have a table in the database called acting, in which generated the`s ID of the areas chosen by the user ex: 1,5,4,9,15 I need the result of the query in Mysql return me all users who have been…
-
1
votes1
answer522
viewsSplit array with multiple INSERT array_push in SQL
I have a foreach that makes the loop in the data of a file, this loop generates some values that are inserted in a array with array_push, I need to break these values inserted in this array to…