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
votes3
answers484
viewsDisplay only the first 3 elements of a list (Javascript, jQuery)
Some elements inside can vary according to the page. I can scroll through this UL, and treat each LI as an element of the Array. My question is how is it possible to display only the first 3 LI and…
-
0
votes1
answer49
viewsLoop "for" does not scroll through all list items
I have a problem with the following function: function limpaLista() { var lista = document.getElementById('resposta'); var itens = document.getElementsByClassName('Repos'); for (item of itens) {…
-
0
votes1
answer1139
viewsPrinting of predefined phrases at random in C
Hello, I’m a beginner in programming and I’m learning to code in C. I want to do a show that has some sentences already defined. Ex c/ vectors: char vet1[100] = {"Hello World!"}; char vet2[100] =…
-
0
votes1
answer159
viewsAssigning lines from a document to a String array
I am trying to assign to a string array certain document lines, the content of the document is this: 3 50 5,80,0 15,5,1 12,30,0 I want, from the third line, each row to be stored in a given Dice of…
-
0
votes1
answer345
viewshow to manipulate an object inside an array in typescript
I use the last version of the angular, and I’m having a hard time passing a value to the field, follow details below I am pulling data from an api and sending in list to a select <option…
-
0
votes1
answer112
viewsError while converting types
I am doing a job for the college that consists of creating an immovable array based on some rules that are provided by txt. The code gives error and do not know what is occurring. A detail that when…
-
0
votes2
answers99
viewsArray returns wrong value in java
I have a question about a college job. I can read with numbers, remove ";" and pass the values to the array while reading the file. However, when I try to access a position of the array outside of…
-
0
votes1
answer69
viewsQuery data in different arrays for reporting
Good to avoid too much processing in my Mysql when generating a report, I prefer to make a simple select and put in an array, so I have more freedom to manipulate the data. But I came across a…
-
0
votes1
answer538
viewsView Java Database Values
I’m a beginner in Java and I’m making a mini RPG-style program for Database Testing, and I want to display the data contained in the BD using a ArrayList, but the result of the exhibition is always…
-
0
votes1
answer111
viewsVariable not defined in SQL query for PHP
I am trying to send an array in PHP, a query with the information of a table in Mysql, but I am finding the following error when I try to print an array position: "Notice: Undefined variable: array…
-
0
votes2
answers78
viewsWhy does the program work despite the invasion of memory in the vector?
#include <stdio.h> #include <stdlib.h> int main() { char s[2]; int i; printf("Entre com os caracteres\n"); for(i=0;i<4;i++) …
-
0
votes1
answer100
viewsUse an array as a key for another associative array
I have these two arrays in php: Array ( [0] => nome [1] => cargo [2] => email ) Array ( [0] => Array ( [0] => nome1 [1] => cargo1 [2] => [email protected] ) [1] => Array (…
-
0
votes1
answer202
viewsChange a char array within a function
I am trying to pass a char array pointer to a function. I want it to make changes to this char array. Follow the function code: void dhnfe( char tzd, char hverao, char *dh) { if (hverao == 1) {…
-
0
votes1
answer956
viewsHow to join arrays with repeated keys?
I got the following code $teste1 = array( 1 => array( 1 => 'teste1', 2 => 'teste2', 3 => 'teste3'), 2 => array(3 => 'teste4', 5 => 'teste5') ); $teste2 = array( 1 => array( 3…
-
0
votes1
answer33
viewsConcatenate two 2D arrays in parallel
How to concatenate two 2D arrays in parallel by returning an array 1D, example: ARRAYS/LISTS lista 1 = [['a'],['b'],['c']] lista 2 = [['A'],['B'],['C']] GOAL: lista 3 = ['a:A','b:B','c:C'] Trying:…
-
0
votes4
answers60
viewsArray assigned to another does not hold the same value
key=[[1,2,3,4],[5,6],[7,8,9,10]] x=key i=0 print(1,key) while i<4: x[0][i]=x[2][i] i+=1 print(2,x) print(3,key) #key era para se manter o mesmo valor, mas quando altera x, key está se alterando…
-
0
votes3
answers613
viewsShow python position of prime only
Read 10 integers and store them in a vector. Then type the elements that are prime and their respective positions in the vector vetor=[] for c in range(3): n = int(input("Digite um número para…
-
0
votes1
answer150
viewsDo not repeat returned Mysqli data
I have this code that brings me the months registered in the bank. But as it has several lines, I want to return only once each value. // Fazendo a conexão $conexao =…
-
0
votes1
answer109
viewsRegistration in foreach php
all right? I’m trying to register several entries in the comic according to the number of installments requested, but I’m not getting. My code: php: $Conn = parent::getConn(); try { foreach…
-
0
votes2
answers377
viewsUnable to convert JSON List to Array in Javascript
I’m having trouble getting the javascript data from a json. To better explain, the data comes from the database, thus: //PHP $rs = mysqli_query($con, "SELECT id_acao as id, text FROM acoes"); $data…
-
0
votes1
answer176
viewsjQuery read json and show sublevels only if they exist
I would like to do a validation, do a printout for the first level and second level of a json, the second level should be printout only if there is that second level in the current array item. Ex de…
-
0
votes1
answer4468
viewsMean numbers of a matrix in C
I need to create a program that will build me a matrix and give me back the media of your numbers. I already have the matrix built but I can’t average the values. The code I already have:…
-
0
votes0
answers205
viewsSave a byte array to sql from a Datatablereader
In one of the system tasks, I need to query an Sql Server database, which returns a Datatable, in this Datatable, one of the data is of the type Byte[] So to read the Datatable use a…
-
0
votes1
answer217
views -
0
votes0
answers37
viewsShopping cart error in array when recovering last id sqlsrv_fetch_array 11- is not a Valid ss_sqlsrv_stmt Resource in
I am mounting a shopping cart but am facing the following error I mentioned in the title. The method takes 2 parameter the $listProducts is an array as all purchase information and the $Total…
-
0
votes1
answer60
viewsArrays in a single index
I made this question today, helped me a lot, now I have the code: foreach ($tokens as $row) { $token1[] = $row['oauth_token']; $token2[] = $row['oauth_token_secret']; } var_dump($token1);…
-
0
votes1
answer54
viewsDimension of a vector passed by reference language C
I would like to know how I discover the amount of positions that have a vector that has been passed by reference to the function, using the language C. Example (Function prototype): int Soma (int…
-
0
votes1
answer164
viewsWhat does this code mean/do?
Well, I’m learning to use Javascript, mainly working with index, and I always come across this, but I want to understand what each part means, because I don’t want to use it without really…
-
0
votes1
answer280
viewsEven numbers in an array with for - PHP
Hello, I would like to understand where my code is wrong. I need to filter only the even numbers of the array using for. But it returns the following answer to me - "The filter is not working very…
-
0
votes1
answer216
viewsReturn Vector within JSON Retrofit Array
How do I bring information from one vector inside another json-format vector to retrofit: I have my return: [ [ {"prato":"BROCOLIS C\/ SALSINHA"}, {"prato":"ACELGA"}, {"prato":"ALFACE + JERIMUM…
-
0
votes2
answers97
viewsHow to get neighboring values at the given offset of an array?
I’m having trouble extracting a portion of any sequentially indexed array, such as a single crease(). The problem is that I need to specify a starting offset and a limit greater than or equal to 1.…
-
0
votes1
answer469
viewsHow do I show some elements of an array following this criterion?
I have to make a php form that at the end shows the price of each product purchased, showing only the prices of the products that in the other column of the table, were marked in the checkbox: FORM:…
-
0
votes2
answers3167
viewsOperations with C++ matrices
To perform the sum of items of a matrix (primary diagonal and secondary diagonal) I was able to write the following code. Can someone help me dry up the code? so I can compare the codes... C++: And…
-
0
votes1
answer629
viewsHow to pass information from a file to a dynamic vector of C structures?
Good afternoon! (EDITED) I’m doing a language work C, where I have to show on the console the information stored in a text file, but it is mandatory to pass all information to vetores structural…
-
0
votes1
answer319
viewsFilling arrays using a recursive function?
I have a recursive function that divides a certain number into parts, example: Number 259, when going through the function it will look like this: 200 and 59, I need to store these numbers in a…
-
0
votes1
answer173
views -
0
votes3
answers201
viewsWhich destructive and non-destructive way to get the last element of an array?
This question came up in a group, but you did not know of such information, you would know the answer?
-
0
votes1
answer1178
viewsHow to go through an array and tell how many objects of each exist in it?
The program is: you type a letter/word in the Input and click on button(add) it appears in div, i was wondering how do I "scan" these words/letters and tell how many of each there are. Example: I…
-
0
votes1
answer340
viewsCorrelating vectors through the Python indexes
I have the following vectors: posicao_1 = [4, 62, 24, 18, 47, 62, 63, 78, 68, 87, 24, 18, 6, 8, 12, 17] posicao_2 = [43, 61, 21, 19, 46, 63, 68, 72, 66, 89, 29, 10, 8, 7, 6, 15] I need to search the…
-
0
votes1
answer141
viewsC# Array number next
I’m in need of help I don’t know but where to turn. The problem and the following we have an Array of type Double. We have a variable x = 91.30 in the Array (a) the nearest value is 91.39. I wanted…
-
0
votes1
answer172
viewsCreate a vector with srand without repeating numbers in C
I am creating a vector with random numbers from 1 to 60 using the Rand function. This vector cannot contain repeated numbers. For example, if srand’s return was number 3, and there is already a…
-
0
votes1
answer48
viewsI have dynamically stored memory of a vector in C, does not return the allocated size, why?
This code is an example of another code with the same problem. I dynamically stored the memory, but when I’m printing the vector size with the len, strangely prints 1 and not 10 as expected. The…
-
0
votes3
answers639
viewsCount to 100 with PHP
I need to complete the array $resultado using the parameter $numero up to 100. For example, if $numero were 45, $resultado should have the numbers from 45 up to 100, the number 100 should also be…
-
0
votes1
answer32
viewsCreate function to change a data in the database table
Good morning, I’m doing a function so I can alter a data in a database table. That is, I have 4 data recorded in my database table where the main is 'yes', when recording a fifth data, the second…
-
0
votes3
answers2499
viewsHow to check and print repeat values in a vector
I have the following problem to check the repeating vectors in a Vector: Given a sequence of n real numbers, determine the numbers that make up the sequence and the number of times each of them…
-
0
votes2
answers78
viewsDoubt about vector in C
Good evening, I have a doubt in the code I made below, my teacher requested that the values name, ra, n1,N2 be read and be displayed to the average of 40 students, I’m trying to put when I try to…
-
0
votes1
answer54
viewsGet value in Array Chunk
I have 12 teams registered in a table and I want to divide them into 3 groups. So I receive these teams in array form and use the array_chunk to divide them, which will form the 3 groups of 4 teams…
-
0
votes0
answers26
viewserror conversion from array to int in c language
Could someone help me understand what error I am making in this conversion. because any digit to print the last characters of the variable key_temp, key_temp2 or key, he is printing ' 0'. // copies…
-
0
votes1
answer228
viewsWhat is a byte array?
What is the byte array in Unity? I know we store data that can be converted into bytes.
-
0
votes1
answer50
viewsArray size set by variable
I checked and I see no mistakes. void exibe (int * , int); int main(){ int n; int m[n], i; printf("Digite o numero de elementos do array : "); scanf("%d",&n); for (i = 0; i < n; i++){…