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
votes3
answers130
viewsArray listing with start and end
Example.. $inicio = '11:00'; $fim = '13:00'; $array = ['10:00', '10:30', '11:00', '11:30', '12:00', '12:30', '13:00', '13:30']; I need to list the array.. but using the start value and the end…
-
1
votes2
answers67
viewsString reading
char nome[100], endereco[100], sexo[100]; printf("Digite seu nome: "); scanf("%[^\n]s", nome); printf("Digite seu endereço: "); scanf("%[^\n]s", endereco); printf("Qual seu sexo: ");…
-
1
votes3
answers1184
viewsRead an Array or Bulk Collect as a table in an Oracle PLSQL
How to load an Array or Bulk into a PLSQL and then read this as a table. Example DECLARE VA_ARRAY ....DEFINIÇÃO DO ARRAY VN_QTD NUMBER; BEGIN -- TABELA01 É UMA TABELA FÍSICA EXISTENTE NO BANCO…
-
1
votes1
answer490
viewsStore values in inverted order
The objective is the following: read 10 values of a given vector, after that, create another vector, which has the same values of the first vector, but in inverted order, for example, the first…
-
1
votes2
answers193
viewsHow to delete both duplicate values from the array?
I get two arrays However, when merging them, the same values must be removed: in array_unique( array_merge($array1, $array2) ) It is possible to remove duplicates, but I want to remove both…
-
1
votes1
answer2439
viewsHow to reference an arrayList of another class
Personal my code is still unfinished and I am creating a library system as college work want to do as a reference to use a list array of another class in a new class. I want to use the same Book…
-
1
votes1
answer259
viewsError when compiling a modularized program in c
I made a program in which reads strings from a file separated by - (hyphen) and saves each string at a position of a struct vector. When compiling, generates the following error message: array type…
-
1
votes1
answer1897
viewsHow to use pointer and vector in a single struct in C?
I cannot run a program that needs functions to execute a procedure, this function receives a vector of type struct by means of a pointer. There is no build error, but the program hangs while running…
-
1
votes1
answer133
viewsGenerate match keys between teams using a PHP array
Opa!! I have the following array on php, need to create a confrontation between teams and teams that are from the same group/array example Time 01 and Time 02 can not face each other in the first…
-
1
votes1
answer594
viewsC Language: Manipulating a vector of structs within functions
Hello, I created a struct: typedef struct { float valor; float peso; } objeto; And within the main() I’ve created a vector of these guys: objeto conjunto[50]; Then I need to swap one 'object' of…
-
1
votes2
answers1267
viewsHow to create a vector by joining together 2
I’m doing an exercise with vectors where I need to read two vectors of 5 positions each, and after that, concatenate these two into a 3 of 10 positions. My program is correctly printing the first…
-
1
votes0
answers61
viewsArray vector has "n" elements, but lenght returns "n+1" in C
Hello, I have the following question: I have a vector and I’m sure it is passed to him only one element through the following loop: char uid[1]; while(indice1 < indice2){ printf("Valor de indice…
-
1
votes1
answer58
viewsException in Thread "Main" java.land.Nullpointerexception com.Login.Login.mai(Login.java:18)
Today I tried to make a login system (again), only this time I used a array one-dimensional to guard my values. When I ran my program, Eclipse had an error (null pointer to be more specific), my…
-
1
votes1
answer326
viewsSend array to Controller and insert into DB, with Ajax and Codeigniter
Hello, I am unable to receive (in the controller) the array that is sent from a View via ajax. I already tested it in the console.log and the array is sent but nothing happens in the controller. the…
-
1
votes2
answers908
viewsIndication of the first negative number of a vector
I have to make a program in C that saves the Inudice from the first negative number, but I’m not able to do it. The question is this down below: Prepare a program in C that enters 5 integers in an A…
-
1
votes3
answers5495
viewsDisplay the values of the c++ vector on the screen
I cannot list (display) the products registered in my Vector. Someone can guide me, I’m learning c++. #include<iostream> using namespace std; int main() { int op, i=0; string produto[10];…
-
1
votes1
answer981
viewsDoubt about how to fill two-dimensional array in Java
I’m doing an exercise and I need help. That’s the statement: Calculate average temperatures for each month. For this, create a list containing the names of each month in the rows, and the number of…
-
1
votes1
answer948
viewsHow to add up the values of an index?
I am new in python and need to make a program that add the digits that belong to the same position of a list, for example: Lista = ['22659', '387685', '89546'] The result of the list sum[0] would be…
-
1
votes0
answers410
viewsStore array in database and recover using one of the array information
I need to develop a system where I capture the selected data from a checkbox and insert everything into a array, I believe this is the most appropriate method for storing, and then send it to the…
-
1
votes1
answer177
viewsforeach with multiple variables
I’m trying a foreach with several variables like? $record = array(); foreach($resultCustomers as $group) { $record[$group['CODIGO_CLIENTE'].$group['RAZAOSOCIAL']][] = $group['NOME']; } $output =…
-
1
votes3
answers97
viewsCheck the existence of the values of one array in the Keys of another
I have two arrays: $Keys Array ( [0] => Array ( [0] => {3} [1] => {1} [2] => {2} [3] => {0} [4] => {4} [5] => {5} ) ); $properties Array ( [0] => Array ( [0] =>…
-
1
votes0
answers69
viewsHow to pass a function in an array in the powershell?
I need to create a script, some of the fields are avoidable and I would like to pass a function to edit it but when I pass it inside the array it pops one ERROR.
-
1
votes3
answers330
viewsArray Pose in Swift
I would like to know how to find the position of an Array in SWIFT Does anyone know? var nomes = ["Douglas", "Marilia", "Roberto", "Carol", "Lucas", "Iasmim", "João", "Zeca"]…
-
1
votes2
answers6230
viewsjavascript multidimensional array
I have the following question. I will simplify as much as I can for you to understand. I am developing a game and have an array of values. This array is multidimensional: var valores =…
-
1
votes1
answer287
viewsPass a php array in a query and return multiple results
I want to pass a dynamic POST array of type: array(2) { [0]=> string(1) "1" [1]=> string(1) "3" } For an SQL query where it returns multiple results depending on the string values in the array…
-
1
votes0
answers144
viewsHow to reverse positions
I am doing a work of LFA (formal languages and automata), which recognizes GLUD languages only that now I would like to make it recognize GLUE languages, which would basically just change the…
-
1
votes0
answers58
viewsError filtering form values by comparing two arrays
I am trying to filter the values of fields filled with an array, that is, check if a string of an array is contained in any of the values coming from a form. Problems: Only the first field is being…
-
1
votes2
answers524
viewsProblem storing data in Array
I’m creating a program that stores a person’s tasks in an array, and shows them these tasks. But I’m having trouble showing the tasks. I can’t show the old tasks. Only the last task typed is shown.…
-
1
votes3
answers600
viewsCreation of Array within Function
I’m trying to do an exercise where I have to create a array within a function, and the same be accessed through an external code (example: ...php? parents=uk and show United Kingdom - London). The…
-
1
votes1
answer88
viewsAvoid using explicit loop, find/edit array with the desired value
I have the following array: $users = array( array( 'id' => 17, 'name' => 'Miguel' ), array( 'id' => 23, 'name' => 'Vera' ), array( 'id' => 39, 'name' => 'Sara' ) ); My question is:…
-
1
votes1
answer233
viewsReturn 2 PDO queries in JSON
I need to return two queries. $id = $_POST['id']; $id = end(explode('editarnovoservico', $id)); $searchid = $pdo->query('SELECT * FROM cad_servicos WHERE id = '.$id); $searchid =…
-
1
votes1
answer62
viewsError in the average calculation of a student record
printf("Nota 1: "); scanf("%.1f", &alu[n].not1); printf("Nota 2: "); scanf("%.1f", &alu[n].not2); alu[n].media = (alu[n].not1+alu[n].not2)/2; // o erro acontece NESSA LINHA invalid operands…
-
1
votes2
answers668
viewsNG-REPEAT inside NG-REPEAT - ANGULARJS
I have a multidimensional array. To demonstrate it in my view I use an ng-repeat in a ul inside another ng-repeat in a li, thus: <ul ng-repeat="section in sections"> <li>…
-
1
votes3
answers196
viewsIs it possible to store values without using static vectors?
I need to create a sparse matrix of the cross-dynamic list type and my cells are the type: typedef struct CELULA{ int linha; int coluna; double valor; }CELULA; But every time I create a new cell in…
-
1
votes1
answer54
viewsThe code is right, but could someone tell me how True and False works in detail in this question (step-by-step)?
"Make a program that, when filling a list with 8 integers, already stores them increasingly. Show the resulting list each time a value is stored" lista = [] for x in range(8): n = int(input("Digite…
-
1
votes1
answer1139
viewsCreation of a random vector
from random import randint # para gerar os nums aleatorios def criaVetor(L, H, tam): vec = [] for i in range(tam): # vamos fazer isto tam (N) vezes vec.append(randint(L, H)) # gerar numero aleatorio…
-
1
votes1
answer962
viewsCondition "if and Else" for sending Ajax, taking the text of the <span> tags?
Kinda hard to explain by the title, but here’s the thing, I have a foreach that prints in a list <ul> <li> tags, and within it I have the following code: <?php if ($row['Status'] ==…
-
1
votes1
answer60
viewsValues of $_REQUEST returning null
I got the following form that sends an array: Form: <form id="form-simulacao" action="controller.php"> <div class="col-md-3"> <div class="form-field"> <div…
-
1
votes1
answer5742
viewsPrint chained list in C
I’m creating a program that receives a vector and creates a chained list. I need help creating the "print()" function, which prints the generated chained list. I don’t know how to proceed. #include…
-
1
votes1
answer182
viewsString for Array/List
I got the following String: [{"Monstro":"Lobo","HP":100,"Level":2},{"Level":"1","HP":"100","Monstro":"Bruxa"}] And I need to put her inside a Array ou List to take the values of each monster. How do…
-
1
votes1
answer53
viewsBlank array - only removing half of them
I have the following array: Array ( [0] => Array ( [Produto] => ENH1264-1 [Quantidade] => 1 ) [1] => Array ( [Produto] => ENH1264-3 [Quantidade] => 2 ) [2] => Array ( [Produto]…
-
1
votes1
answer841
viewsSeparate a JSON array into columns and rows
I’m getting a JSON array in the back end this way : { "idDistrito": "23", "nome": "rere", "codigoDne": "154545", "cns": "565665", "entidade": { "idEntidade": "1", "nome": "Entidade 01" },…
-
1
votes1
answer391
viewsGenerate 9-digit keys with Python
I would like to generate several values following the pattern XXX-XXX-XXX where all possibilities will be generated for example: 1 - 000-000-000 2 - 000-000-001 3 - 000-000-002 . . . x - 999-999-999…
-
1
votes1
answer51
viewsUnread array with index set in input
see below the following code: <input type="text" id="task" name="task[]" value="100" /> <input type="text" id="task" name="task[]" value="110" /> <input type="text" id="task"…
-
1
votes1
answer518
viewsSave an array from the form to the database
I have tried several ways to save the data that comes in the form in the database but it is not working, when using PHP5 worked but now converting to PHP7 stopped working, someone can help me. The…
-
1
votes1
answer233
viewsIs there any way to compare all received parameters?
I have the following method public Boolean Teste(String nome, String telefone, String...) { if(!string.IsNullOrWhiteSpace(nome) || !string.IsNullOrWhiteSpace(telefone)...) {} } There is how to…
-
1
votes0
answers124
viewsHow to know the index number in a multidimensional array?
Information: Rooms: 25; Teachers: 4; Q02, Q03, Q04: A student in a class classified the teacher from 0 to 10. From these numbers, a media was generated. There is a select with the list of teachers,…
-
1
votes2
answers179
viewsEnabling fields (array) with Jquery when checking checkbox
Good afternoon guys, once again I need your help for the following problem: Imagine the following form records below: <input id="check[1]" name="check[1]" type="checkbox" value=""> <input…
-
1
votes2
answers66
viewsregroup values of an array into a new array
I have an array of values like this: [{season:1, episode:1},{season:1, episode:2},{season:2, episode:1},{season:2, episode:2}] what I want to do is get the key Season and group in a new array like…
-
1
votes2
answers1031
viewsDivide vector according to delimiters and copy content to other strings in C
I need the main string "vector" to be traversed to the delimiter '=' and copy the values before '=' to "second" and the values after '=' to "third". I’m sure there’s a smarter way to do this, but as…