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
votes2
answers9251
viewsHow to check a null position in the vector
Why do if(array[i] == null) is not correct? What would be the best way to check if that vector space is "empty"?
-
2
votes1
answer505
viewsFormat Array differently
I have the following array(): Array ( [valor] => Array ( [0] => 433.36 [1] => 433.36 [2] => 433.36 [3] => 433.36 [4] => 433.36 [5] => 433.36 [6] => 433.36 [7] => 433.36…
-
2
votes1
answer1762
viewsAutocomplete: JSON + PHP
With the codes below my output coming after typing "Al" is only "Albania", and the same comes duplicated in the autocomplete. The result coming in Chrome console is: >…
-
2
votes1
answer2561
viewsHow to make an array of objects?
How to make a array of objects? I am trying but am not succeeding, returns me an error: line 26 [Error] no match for 'Operator[]' (operand types are 'Time' and 'int') Code: #include <iostream>…
-
2
votes2
answers66
viewsSearch something in a list and say whether it exists or not - Display Value, and amount
Good afternoon, what is the easiest way to make a list in which it contains several items, for example meat, fish, bread etc, and from the variable $_GET know if the product exists or not ? I tried…
-
2
votes1
answer212
viewsHow to get the generated Array from the print_r() function to send in the email?
I’m developing a log system and need to get the data generated by print_r(), to send in the email if any error occurs in the API, this way the developers will be warned, already containing all the…
-
2
votes2
answers1818
viewsSearching for a matrix within another matrix in Java
I need to compare two two-dimensional matrices (int[][]) of different sizes, the two being formed by integer values (1 or 0), to verify if there is the smaller matrix within the larger matrix.…
-
2
votes2
answers31
viewsHow to remove Level 1 keys using only one Callback method
I don’t want to use foreach and neither for. For example, I have the following array structure: Array ( [0] => Array ( [0] => Array ( [id_usuario] => 1 ) [1] => Array ( [idade] => 21…
-
2
votes2
answers125
viewsHow to get a return of an Array<String> in a GET call with task.resume()?
Good afternoon, you guys. I’m having a hard time uploading the content of a Pickerview in my app, as it needs to fetch the information in a call GET, the call works and I can assemble the array with…
-
2
votes1
answer121
viewsMark unused positions on a vector
We assume that, in a given implementation, the positions of a vector may contain values of -2^16 to 2^16. You need to "mark" unused positions (for example, put a * ). However, given the range of…
-
2
votes1
answer89
viewsNavigate specific value in PHP Array
I have a connection via api with a third party system, I am receiving the values in this format: Array ( [code] => 200 [data] => Array ( [subscription_id] => 2752 [status] => new…
-
2
votes1
answer3064
viewsSend form data by array to PHP
Due to a system need we are working on, I need to send 3 fields as an array to a PHP. Example: <input type="text" name="name[]" /> <input type="text" name="name[]" /> <input…
-
2
votes1
answer4641
viewsHigher value of a vector, with recursion
I’m studying recursion and vectors, but I can’t understand how this method works, which returns the highest value using recursion. int maximoR (int n, int v[]) { int x; if (n == 1) x = v[0]; else {…
-
2
votes2
answers109
viewsSearching in array using more than one word
I want to search one array and use more than one word, the problem is in the fact that I want it to only return something to me if there are all the words in array and not just one, I’m doing it…
-
2
votes1
answer3201
viewsHow do I know the address of each vector position in C?
I’m having trouble knowing the vector address and address of each vector position. #include <stdio.h> int main(){ int vec[]={52,13,12,14}; printf("Endereço de vetor %d",&vec);…
-
2
votes2
answers282
viewsI can’t divide with a vector element
I made a code to simulate the Monty Hall paradox, so that I can simulate 1000 times the results and write the statistics. However, I cannot divide an element of an int array by an int, every time I…
-
2
votes2
answers812
viewsCheck for repeated numbers between two php arrays
Ola, I have two arrays in php and I need to check if there is a number in array 1 that repeats with some number in array 2. I don’t need the numbers, I just need to know if it repeats! How to do?…
-
2
votes2
answers438
viewsPHP global array as time table
I’m in the middle of a problem, I’d like to use a array as a table temporary, sort of like this: $array = [ "codigo" => "0123", "descricao" => "produto" ]; But I would need him to go global,…
-
2
votes1
answer116
viewsHow to extract a given index within this array with a for?
I’d like to extract all the clues [Foto] of this array but still do not understand correctly how to do this as I am still struggling with learning array multidimensionais. What I was able to do was…
-
2
votes1
answer3931
viewsVector file content in C
I need to read a text file and store each word of the file in a vector position. The reading was done normally and the file was passed by parameter such as the amount of words. The code performs the…
-
2
votes1
answer434
viewsGenerating valid Php Array for json conversion
Explaining a bit of the purpose of the code: Through the sql query returns data, the only data needed is the 'id' and the name of the 'area', then two arrays are created, one to receive the 'id’s…
-
2
votes3
answers582
viewsHow to dynamically increase struct size?
How to increase the size of struct when the current size is reached? #define TAM_MAX 50; typedef struct{ char nome[TAM_NOME]; /* nao pode ser vazio*/ char sobrenome[TAM_SOBRENOME]; char…
-
2
votes1
answer10706
viewsHow to use foreach with this type of JSON (PHP)
I am trying to display the values of a JSON with PHP more unsuccessfully. Code Used: JSON { "friendslist": { "friends": [ { "steamid": "76561197960265731", "relationship": "friend", "friend_since":…
-
2
votes2
answers261
viewsDo not show 1 row of empty array using Angularjs Asp.net mvc?
I have the following code: <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!--inserindo a meta tag de keywords onde definimos as palavras…
-
2
votes3
answers8934
viewsHow to extract and list values from a multidimensional array?
I have this array: Array ( [Bairro] => Array ( [0] => Aberta dos Morros [1] => Camaquã [2] => Cavalhada [3] => Cristal [4] => Guarujá [5] => HÃpica [6] => HÃpica/Jardins…
-
2
votes2
answers758
viewsHow to create dynamic columns with Bootstrap and PHP?
I have 30 itens that will come in alphabetical order. I need to distribute these items in 3 columns in alphabetical order VERTICAL. The problem is that in Bootstrap, the blocks are marrying each…
-
2
votes1
answer234
viewsPrint all results of a vector with a given value
I am starting the studies in C. I have a question of how to go through a vector looking for a value and print showing with printf all values found. The program I’m doing:…
-
2
votes2
answers762
viewsHow to transfer a full array of the form to another PHP file?
I have this form and I want to pass the array (as is) $array_dos_pagamentos to the recive.php but I can only pass unique values. How can I pass the full array? <form…
-
2
votes1
answer405
viewsDelete repeated words from an array and sort it
I have a certain function that returns to me array disorderly with several repeated cities. This way: <?php function getArrayCities() { return array("são paulo","rio de janeiro","belo…
-
2
votes1
answer94
viewsWHERE in bigint field[]
I have to perform a query to know if the code of a group is in the permissions to see the field. SELECT * FROM callcenter.pausa WHERE habilitado = 1 AND permissao_ver::varchar ilike '%1%' ORDER BY…
-
2
votes1
answer1768
viewsHow to insert the size of an array as per user input?
How do I enter, asking the user through the class Scanner, the size of the matrix and it tells me the column and row numbers you want, and then print the values, without using methods? I tried but…
-
2
votes2
answers131
viewsWhat is the limit of multidimensional vectors?
I’m doing a test and it gives me an error when I try to create a vector[1000][1000]. There are limits to vectors? The error code (application ceases to respond) is the following: int main (){ int…
-
2
votes2
answers2074
viewsDynamic matrix allocation in C++
I would like to dynamically allocate this matrix in C++: int main() { int n,m; cin>>n>>m; if(n>m){cedula tabela[n][n];} else {cedula tabela[m][m];} return 0;} but the code does not…
-
2
votes1
answer215
viewsDefine an array and the type of a function in C
Hello, I am developing a C language boot project, namely the creation of a Multimedia Management System that will have to be able to manage a database of discographic articles such as Cds, Dvds and…
-
2
votes2
answers2979
viewsInvert values from one vector to another vector
I am in the second semester of college, we are learning vector, and I am very lost in the exercise list. An exercise asks the user to type 5 elements for a vector, and then I have to take these…
-
2
votes1
answer1278
viewsHow to rotate an array (array) in Java?
I have a two-dimensional array, of size M x N, that stores Tiles of a map, in the following format: [1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12] And I want to rotate 90º (e.g., turn the map so that…
-
2
votes2
answers396
viewsfill array to generate json javascript
I need to fill a multi-dimensional vector to transform into json, I’m not getting it I think the last value always overrides the previous one array_fotos = { "id": 1, "foto": imgName, "tamanho":…
arrayasked 7 years, 8 months ago hyperpixel 389 -
2
votes3
answers1110
viewsMultidimensional array of different types
I have a view in my application database where I account for the user’s name, his sector and the total number of records issued (another table’s count): Table(View) Totalporusuario Columns:…
-
2
votes1
answer439
viewsStore vector in Sqlite
I am creating an application in C# that must have a database. At first I’m thinking of using Sqlite for simplicity. But for each data entered in my bank must have : Identifying (int, char, bool)...…
-
2
votes1
answer641
viewsTbytedynarray for String Delphi 7
I have a method to convert a file to Base64 that returns a Tbytedynarray, and wanted to convert this Tbytedynarray to String. I’ve tried some ways and it hasn’t been working. Error :…
-
2
votes3
answers1589
viewsInsert data into a multidimensional array
I have a multidimensional array [0] => Array ( [per] => Array ( [per_dep] => Array ( [0] => 1115921 [1] => 1705572 [2] => 1126464 [3] => 1131324 ) ) ) And I would like to change…
-
2
votes2
answers429
viewsCreate dynamic variables in Javascript
When I’m in PHP and has dynamic variables, e.g.: nomeVariavel1,nomeVariavel2, nomeVariavel3, I use it as follows to place on the bench: $nomeVariavel = ${"nomeVarivavel".$contador} How can I do…
-
2
votes1
answer1731
viewsSearch repeated numbers in list with Visualg
Write a program that receives 100 numbers typed by the user. At the end the program displays how many numbers are reported equal to the last number typed. As far as I can go: algoritmo "semnome" //…
-
2
votes2
answers109
viewsVariable outside matrix boundaries
I’m trying to put the items in positions of a matrix, but I keep getting the error that the variable is outside the matrix limits. I don’t know how to fix the mistake and I need help. Follows the…
-
2
votes2
answers1061
viewsMost odd number
I spent hours trying to solve, I started to think that the problem might be in the compiler, since it returns me a different (and wrong) number at each run What could be the mistake? #include…
-
2
votes3
answers2408
views -
2
votes0
answers269
viewsGenerate random numbers in a vector of floats in the C language
I would like to know methods of generating a sequence of random numbers, ranging from 0 to 10, of type float in a size 10 vector.
-
2
votes2
answers840
viewsNumbers located in odd positions
I should present only the numbers present in the odd vector positions, but I’m stuck: package pag1; import java.util.Scanner; import java.util.Arrays; public class ex1 { public static void main…
-
2
votes2
answers9106
viewsRemove array element in C
I have the following struct. struct cadastro{ int codigo; char nome[200]; char cpf[11]; char rg[10]; char tel[12]; char end[100]; }cadastro;//struct do tipo cadastro. and the corresponding vector…
-
2
votes1
answer74
viewsWhy "new Array" after variable?
Why put new Array after the variable name? Example: var weatherPattern = new Array('Clouds', "raining", "clowdy");