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
-
2
votes1
answer593
viewsInsert data from an array into the database by Codeigniter
I’m trying to make a INSERT using Codeigniter and would like to know if there is a more practical form than the one used below: MODEL public function set_cliente() { $dados = array( 'codigo_cliente'…
-
2
votes1
answer176
viewsSplitting string in C
I am very beginner in C yet, but I have a lot of experience with python, I have a project that I need to receive from the user 3 numbers in the same line and make a vector with these 3 numbers in…
-
2
votes2
answers73
viewsHow can I get an Array’s Index number?
How can I acquire the number of elements that has the value of day of 5. This would have to return me another Array, for the manipulation to become more dynamic. This is the Array I have based on:…
-
2
votes1
answer28
viewsArray does not return value using a static method function
In this static function all variables return their respective values, except $funcionario which is an array. Where am I going wrong? class Dtb{ public static $funcionarios =['M','G','N','I'] ;…
-
2
votes1
answer1122
viewsBrowse Arraylist of object objects and compare c#
I was wondering how I can reuse the object I put into an array list because I can’t compare it to anything, and how I compare an object inside it to another, in this college program the goal was for…
-
2
votes2
answers1991
viewsHow do I determine the number that appears most often and the position it is in?
It was performed the reading of a vector of n positions, as I do to determine the number that appears more and the position where it is? programa { funcao inicio(){ inteiro vetor[] inteiro numero,…
-
2
votes1
answer3943
viewsHow to compare vectors in C
Hi, I’d like to understand why my code doesn’t work. I’m trying to develop a forcible application and I can’t get the typed letter to be compared to the letter that’s in the vector, which I’m doing…
-
2
votes1
answer39
viewsConfusion in access to vector size in C bytes
In the code below: #include <stdio.h> void testaTamanhoVetor(int vetor[]) { printf("tamanho do vetor em bytes na funcao: %zu", sizeof(vetor)); } int main() { int a[10]; printf("tamanho do…
-
2
votes2
answers454
viewsInserting index and value into a two-dimensional array
I have a two-dimensional array (it contains data from the database). To go through this data, I use a foreach(). I need to add an index and a value to that index at the end of each foreach…
-
2
votes3
answers408
viewsSort array by itself within PHP Intel
I am working with the datatables, and by chance of the destination I decided to use the function ajax from it, I did the whole process, but one thing is missing, to be able to reorder the array,…
-
2
votes1
answer27
viewsError reading Localstorage array
Hello, I have an array and the user can shuffle the order of the items: Blusas = ['verde','azul','amarela','rosa','laranja','preta','roxa','vermelha',] After shuffling, this is the update capture…
-
2
votes2
answers71
viewsHow to extract substring in string array with Javascript using match?
I have to manipulate a data in the following format: ["nome <email desse nome>"], an array with several strings in the same format. I want to extract in another array only the emails, without…
-
2
votes1
answer737
views -
2
votes1
answer32
viewsFunction filling only one line
I created a function so that as the user type a client number, is filled the fancy name of it, but as this data comes within a table and I use array to capture (fazer insert e update) in this data,…
-
2
votes1
answer1053
viewsAdding arrays (vectors) with methods
I have an exercise to do: create a method where the user enters the values of 2 vectors, then create a method to sum the values of the 2 vectors and finally a third method that shows the new vector…
-
2
votes1
answer42
viewsReturn Number of Responses PHP Array
I have the following array(): Array ( [0] => stdClass Object ( [men_id] => 3 [usu_id] => 2 [usu_destino] => 2 [id_resposta] => 0 [usu_respondeu] => 0 [set_assunto] => 147…
-
2
votes1
answer118
viewsAppropriate PREG MATCH rule
I created a loop that shows all months of the year with the following code: for($i = 1;$i <= 12;$i++){ } then I created a $_GET variable that would receive a rule like the following:…
-
2
votes1
answer155
viewsHow to check the size of a PFA-type array?
How do I check whether the array PFA (Partially-full array) is full and new elements cannot be added? If it is full, it should return true. boolean estaCheio(int[] data, int size){ ??? } I have 5…
-
2
votes2
answers174
viewsVector receiving a function that returns integers
Guys, I have some questions about vectors and functions. public class teste{ /*Função que retorna um vetor de inteiros com números aleatórios*/ public static int [] vetorFuncao(){ int…
-
2
votes1
answer63
viewsrecover a client name in a multidimensional array
I am creating a script to execute procedures in the database of some customers, I have the following arrays with the credentials of each: $hosts["Cliente1"] = array("ip"=> "ip_do_cliente",…
-
2
votes2
answers3226
viewsGet PHP Array Value
Array ( [0] => [1] => Array ( [0] => #EXTM3U ) [2] => Array ( [0] => #EXTINF:-1 tvg-id="" tvg-name="BBB 18 -Aquecimento"…
-
2
votes2
answers108
viewsQuestion about array size
I have a question regarding the array, for example, if I have 2 arrays of size 9 and print the values of both it is normal for input 9 to get the value 0 of the next array ? This is more of a test,…
-
2
votes1
answer70
viewsHow to verify if a file containing a specific word exists?
I am using PHP, and in a server folder contain files with these names: T3497012@16-01-02:21@[email protected] T3497012@16-01-02:22@[email protected]…
-
2
votes1
answer214
viewsSimilarity of Texts
Good evening, you guys, I would like a help from you, because I am starting in R, and I have a demand, where I have to signal the lines where there are similar phrases. For that, I’m using the…
-
2
votes1
answer199
viewsHow to transform more than one vector into an array using the php language?
I have a file matriz_caminhos.txt with 20 rows and 20 columns, I need to access it and take the data as an array. So far, I just got it to scan the file and return me 20 vectors. Follows the code: .…
-
2
votes2
answers67
viewsBrowse an array where the index is a Date
How do I go through one Array where the index is a date that varies with each query in the Database. Just a detail, the dates are dynamic at each consultation. The Array arrives that way: Array (…
-
2
votes1
answer107
viewsreturn of array_search() considered false condition
In my code, in the login screen I search in the comic the number of blogs that belong to the same user and put the ID of these blogs in an array, then assign it to a session variable (I want my code…
-
2
votes1
answer150
viewsProblems with the Realloc
Good afternoon, I’m having difficulty creating a program that increases the size of a structure called list , similar to an array, whenever the occupancy rate of this list is more than 80% filled so…
-
2
votes1
answer1214
viewsHow to copy values from one vector to another quickly
I’m making a question that the number of elements in the vector are in 10 6 and just wanted to copy certain element to it only that I did the normal way, but common, there is another possibility if…
-
2
votes1
answer44
viewsHashtable: Segmentation fault when inserting - C
I am trying to implement a hashtable, in which the table would be an array of "buckets" in which each one contained user information, my code: #define tam_inicial 23 typedef struct user{ char…
-
2
votes3
answers92
viewsInsert summary when there is a change in a PHP Array
to with a doubt that may be easy, but to broken the head, I have a table that is generated through an array, follows code below: foreach($grupo_arr $k => $v){ ?> <tr> <td><?php…
-
2
votes1
answer1711
viewsSimple text editor in C
I have the following exercise proposed: Make a program that mimics a text editor. Initially you will read the data typed by the user (lines of text) and create a vector in memory where the texts…
-
2
votes1
answer238
viewsPerforming array validation within another array
I have the following array, when I give a var_dump(): array(2) { [""]=> array(10) { ["js/ultramegamenu.js"]=> string(19) "js/ultramegamenu.js" ["js/padoo/jquery.cycle.js"]=> string(24)…
-
2
votes1
answer298
viewsDetermine sequence of numbers with Bubble Sort from a python txt file?
I have a txt input file with data type the below: 7 6 8 4 8 5 0 1 2 1 0 3 2 3 0 This file is about information for 3 students of a school. The first line is the age of these 3 students (the first…
-
2
votes2
answers744
viewsHow to remove line breaking from txt file in PHP array
I have a txt file extracted from a PDF. I upload this txt via php, and need to remove the line break between the description items and put in an array, follows: TXT ORIGINAL: 0235.000001-4…
-
2
votes2
answers98
viewsUsing PDO links in PHP
I am trying to create a loop with PDO where I can choose the desired field to position it on the page. But the code I’m using is bringing all the fields at once. My code is like this:…
-
2
votes2
answers181
viewsValues returned in comparison of strings in C
I was reading about some of the functions of header string.h in http://www.cplusplus.com/reference/cstring/ and I came across some comparison functions between strings (useful after all), such as,…
-
2
votes0
answers231
viewsConversion from array to two-dimensional array using parameter
I have a question regarding the conversion of vectors (array) to two-dimensional vectors. I need to read a string and separate the columns when a blank is found. I did this using the method split()…
-
2
votes1
answer156
viewsJsonconvert.Deserializeobject returns null
Segue json: [ { "id":"BKA-EU8IED8ZD21Q", "agencyNumber":"1", "accountNumber":"1", "holder":{ "thirdParty":false, "taxDocument":{ "number":"783.121.360-02", "type":"CPF" }, "fullname":"Leandro da…
-
2
votes3
answers1758
viewsOrganize array in alphabetical order
Good when I want to organize an array in alphabetical order based on an array field I do so: // Compara se $a é maior que $b function cmp($a, $b) { return $a['nome'] > $b['nome']; } // Ordena…
-
2
votes1
answer653
viewsHow to check if all values are equal in a vector in r
I have as response of a function the vectors RMSEA, GFI, NFI and CFI that can contain all equal values. In sequence I use the algorithm below to test normality through the Shapiro-Wilk test. When…
-
2
votes1
answer237
viewsHow to sort an array by the frequency of appearance of each element?
Not to delay too much I go straight to the point, I am trying to make a program for an exercise that possessed the following instruction: Build a function int ordenaFreq(int v[], int n) efficient,…
-
2
votes2
answers111
viewsPointers and matrices catching something unexpected
#include <stdio.h> int main() { int vetor[][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; int valor= *(vetor[1] + 1) + **(vetor + 3); printf("%d", valor); } The code above was taken from…
-
2
votes3
answers593
viewsHow to get all $_POST information
I have an array sent by $_POST: array(4) { ["gabarito"]=> string(1) "4" ["resposta1"]=> string(1) "A" ["resposta2"]=> string(1) "B" ["resposta3"]=> string(1) "A" } I need to take this…
-
2
votes1
answer300
viewsPHP - How to find the least common element in an array
The job is to create 2 arrays with random numbers between 0 and 30. These 2 arrays should be drawn from the most common element to the least common. Next I have to show to the screen the most…
-
2
votes2
answers58
viewsExchange array data between’S' and 'N'
I have a function that I will adapt to a button, which will exchange a data within an array, between S and N. The code I have is: var array =…
-
2
votes1
answer84
viewsHow to assign character array in a structure?
The program reads 10 films, each film has gender name, and age rating, then lists; I’m having trouble assigning matrix string (I think it’s just that mistake) #include <stdlib.h> #include…
-
2
votes2
answers142
viewsError summing each row of a 5x3 matrix
Hello, I’m having a problem adding up each of the lines of my matrix and storing in a vector my code is like this: #include <stdio.h> int conta(int * matriz[5][3], int * vet) { for (int i = 0…
-
2
votes1
answer383
viewsProblem when removing all attributes of an object containing null values
Context I’m inside an application in Nodejs, where I have a very large object that has various attributes and also attributes objects that have children, and I have a situation where I can’t keep…
-
2
votes0
answers321
viewsRemove accent from a string in C language
I’ve got a college paper on Threads and competition control (Openmp) in C, which is giving me a bit of a headache. The job is to take a text from any file and separate it between Threads producers…