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
votes0
answers52
viewsHow do I step by parameter in "literal template" the name of a specific property of an object in Javascript?
My question is this: I intend to eliminate a specific object through a property tech which I defined, which stores the technology as I add through an HTML form. I created an empty array const…
-
0
votes1
answer16
viewsHow to get a list of images in a size of 200px in Blogger?
I have the function below that provides me an array with a series of Blogger posts with the appropriate images, links and titles of these said posts, and the images come with the size of 72px. I’ve…
-
0
votes1
answer42
viewsHow to create a parameterized variable?
In one exercise I must create a valid number for credit cards "Luhn’s Algorithm". need to create a parameterized variable to avoid using if, but the code gets too big and I want to reduce it I can’t…
-
0
votes1
answer150
viewsHow to delete two related numpy array elements?
My x and my y to plot are: x0_n125n25matriz= [ 3472.222 3501.157 3530.092 3559.028 3587.963 3616.898 3645.833 3674.768 3732.639 3761.574 3819.444 3848.379 3877.315 3906.25 3935.185 3964.12 3993.055…
-
0
votes1
answer55
viewsHow do I make a multidimensional array return by ajax
good morning, I have the following code (this working), it returns me to Ajax an array with integers. <?php date_default_timezone_set('America/Sao_Paulo'); require_once '../conexao/conexao.php';…
-
0
votes2
answers72
viewsProblem using push in JS array
I am entering some dates formatted in a array. When I select per day, the format needs to be "DD/MM", but I get from API "MM/DD", in this case I do the inversion after the push in the array, due to…
-
0
votes2
answers116
views -
0
votes1
answer201
viewsHelp in JS arrays
People I’m doing a course and I can’t get past this exercise. Write the function "medalText(number)", which takes a number as a parameter. Using only the maximum of an "if" only. Maybe arrays can be…
-
0
votes1
answer117
viewsHow to get the next attribute of an object array?
Good night, guys, so I’m locked in a code here. I have an array of objects, and I will receive an input name, which is found in one of the "display" objects of the array below, for example "Márcio…
-
0
votes1
answer48
viewsImproper storage in the vector
I’m having trouble solving this algorithm in c. I need the user to type 10 numbers, and check if the number is even or odd. store these numbers in two distinct vectors, one for even numbers and one…
-
0
votes0
answers20
viewsArray sorting in C -- Error in float version
For some reason I don’t know, when I change the type of my int function to float it just doesn’t work properly: void organizeArray(float array[], int size){ int aux; for (int i = 1; i < size;…
-
0
votes1
answer47
viewsHow to apply the same condition/operation for each element of a vector in C
Hi, guys! I need to perform the same operation for all elements of a given vector. How to do this? More specifically, I need to check if an element any "x" has, in its two adjacent positions larger…
-
0
votes1
answer1695
viewsHow to add values of an object array[JS], with only functions and loop for?
That is the question: Sum of expenditure and revenue Create a program that calculates the sum of revenue and expenses of users and at the end returns the balance (revenue - expenses). Use the user…
-
0
votes0
answers60
viewsGroup object array according to operation result
I have an array of jobs, each job has an ID and a certain amount of hours to be done. What I have to do is group these works, in groups that do not exceed 8 hours worked. For example, with the…
-
0
votes1
answer440
viewsCan I work with array in SQL SERVER?
Hello fellow collaborators... I have a server that has more than 100 banks, and most are of the same structure. I would like to create a function, process or whatever. That could expedite my…
-
0
votes2
answers165
views"setState" problem using React
I have a code in React that uses the hook useState in that way: const [tarefas, setTarefas] = useState([]); It is a task list code, every time I remove a project I have to update the project of each…
-
0
votes1
answer72
viewsI want to put inside an existing ARRAY the information of a text file . TXT with PHP
The idea is to translate a system into PHP, where each ARRAY key is a translation. Manually I have already managed to remove all keys and translate them, separate each translated key in a row,…
-
0
votes1
answer97
views -
0
votes1
answer39
viewsConflicting results passing an Array as parameter
The idea is to create a function that, given a one-dimensional array/vector, returns the number of elements present in that array/Array: #include<stdio.h> #include<stdlib.h> #define MAX…
-
0
votes3
answers799
viewsPrint different data from an array according to the element value
We have a list of all the family members forgot to put their last name!. Your challenge will be to print name along with the surname "Macedo" to each member of the family. But we have an exception,…
-
0
votes1
answer75
viewsHow to store numbers in a vector to display it later in C?
I have to make a code in which the user type 20 values, I must count the values greater than 10 and then display them later. I am able to count how many values are greater than 10, but the display…
-
0
votes1
answer88
viewsHow to show the name of all arrays inside an object?
I’m making a search system and with a problem to show the name of the arrays inside the object. The object is in this style: let item = { descricao: "Casa", id: 123, localizacoesFilho: [ {…
-
0
votes1
answer100
viewsCreate an Array with the numbers typed by the user
Hello, everyone. I’m a beginner in the study of Javascript and came across a problem that may be relatively simple. The question is this: I cannot get the numbers sent from the variable "num" to be…
-
0
votes1
answer52
viewsHow to Count Integers Repeated Every 5 Values in an OR Vector to Each Row of a Table (Two-Dimensional Matrix, Example: matrix[3][5] ) C++
I have a vector that only has integers 1 and 2 randomly allocated. Example: int vetor[15] = {1,1,1,2,2,1,1,2,2,2,1,1,1,2,1}; How the vector would be printed: 1 1 1 2 2 1 1 2 2 2 1 1 1 2 1 I have…
-
0
votes1
answer89
viewsHow to execute one at a time items from a sequence array using Promise - Javascript
I have an array where I want to execute each item, but one can only start after finishing the previous one. The example below is printing in sequence 2000,5000,10000 which makes me understand that…
-
0
votes1
answer59
viewsHow to group items from an array with the same category in PHP
I have a array in PHP that follows the following pattern: array(3) { [0]=> array(3) { ["id"]=> string(1) "1" ["categoria"]=> string(7) "Celular" ["produto"]=> string(8) "Motorola" }…
-
0
votes1
answer214
viewsPrint Matrix (C)
I’m trying to print a matrix over the months, but I’m not getting it. It’s a test for another code I’m doing. The goal is to stay: Janeiro Fevereiro Março Abril Maio Junho Julho Agosto Setembro…
-
0
votes2
answers740
viewsMultiply a matrix by a vector
I need to make a program that multiplies a 3x3 matrix by a vector 3, and store the result in a new vector. But I can’t get the result and the problem is probably multiplication. public static void…
-
0
votes0
answers23
viewsReact Hook does not accept value returned from an Axios template
As you can see I created a state called cur and within the map of the mat array, I’m making a request and I want to add the answer inside the event. But when I give console.log down there the state…
-
0
votes1
answer65
viewsHow to add the answer to an Axios request in an Array?
I am trying to put the answer to an Axios request inside an array, but I am receiving as a response a strange structure, as I will show in the following image: I created an Array, added my own name…
-
0
votes1
answer164
viewsSumming Values of an Array Grouping by Key
I posted a question here this week, but it was negative for lack of more information, from then on I ended up solving the problem in question, so I will leave here the solution I found and if you…
-
0
votes1
answer83
viewsInvert string in C - String problem with even number of characters
Well, I have the code below that should reverse a string and show if it is a palindrome. However, when the word has an even number of characters the result is wrong. I think the error is in the…
-
0
votes1
answer44
viewsHow to use function to sum 3 matrices
I’m having trouble creating a function. I have my program ready, but I’m doing an exercise where the function is mandatory and I’m not getting. Java public static void main(String[] args) { Random…
-
0
votes1
answer204
viewsCall a function that returns an array C#
I need the user to enter a number that will be the amount of numbers to be calculated, for example: if I type 4, there will be 4 different numbers to do a given action (add, subtract, multiply or…
-
0
votes1
answer1069
viewsHow to count repeated items with javascript?
Example: const cores = [{id: 1, cor: 'azul'}, {id: 2, cor: 'azul'}, {id: 3, cor: 'azul'}, {id:4, cor: 'verde'}, {id: 5, cor: 'verde'}, {id: 6, cor: 'azul'}, {id: 7, cor: 'verde'}, {id: 8, cor:…
-
0
votes1
answer184
viewsError computing mean with vector C
I am trying to calculate the note average of an array in which I made dynamic allocation, but the following error appears: line 66- [Error] invalid Conversion from 'int*' to 'int' [-fpermissive]…
-
0
votes0
answers61
viewsFatal error: Uncaught Error: [] Operator not supported for strings in
Hello. I have a options with custom fields in a form. I’m getting the Fatal error: Uncaught Error: [] operator not supported for strings I have read that [] is an operator no longer allowed after…
-
0
votes1
answer47
viewsAdd JSON array value in PHP
Hello. I need to add all the arrays totalValue of this Json structure. In this case I wanted it to return 18897+13709 = 32,606 array(5) { ["list"]=> array(9) { **[0]**=> array(29) {…
-
0
votes0
answers115
viewsmalformed calls from js field Sizes are Different
I’m trying to send an array of images to the Back-End but React Native shows this error: Malformed calls from JS: field sizes are different I don’t know this mistake and I can’t find a solution.…
-
0
votes1
answer128
viewsRelate two vectors/arrays of different types and sort them in C++
I have a file . txt from where I need to collect the data (will be placed below). The first column refers to the part code and the second refers to the piece name. I need to find a way to sort the…
-
0
votes0
answers59
views -
0
votes1
answer154
viewsError inserting elements into a vector - C++
I’m trying to call the job montVetorCodigo and montVetorPeca waste of main but I have tried several ways to put the elements of a TXT file inside a vector but it only stores the columns of the last…
-
0
votes2
answers150
viewsRegex to remove the comma with a previous space
I have this string. Code: mrkk-918278 ,Title: Blouse-02 ,Price: R$ 60,50 ,Qty: 1 ,Code: mrkk-918277 ,Title: Blouse long sleeve ,Price: R$ 50,50 ,Qty: 1 ,Code: mrkk-918279 ,Title: Blouse-03 ,Price:…
-
0
votes0
answers8
viewsHow to increase the size of a vector running in the java language
I am making a program that manages the box of a Java store and need to increase the vector size while running without using collections... Go part of my code... How do I reference one vector to…
-
0
votes1
answer37
viewsScanning JSON ...and repeating images
What’s wrong with that code? In the first item of the catalog has 2 images, and in the second item has 1 image (JSON). But on the page when executed it shows the first item with all 3 photos and the…
-
0
votes1
answer41
viewsProblems with append incremetando until the infinity in Python
I’m doing a program that scans 35 bits on a piece of equipment, storing reference bits in an array. The logic to know if any bit has changed since the last reading, always saves the previous result…
-
0
votes0
answers50
viewsHow do I compare the address of a vector position N with an address the user enters?
I’m having trouble solving this question. Could someone help me ? Follow the body of the question: 6 - Make a program that simulates 'virtually' the memory of a computer: the user starts by…
-
0
votes1
answer70
viewsVariable value is changing automatically
I have a question about assigning values to variables. I created the following code for solving equation systems by the Gauss-Jacobi iterative method: A = np.array([[2., -1.], [1., 2.]]) # Matriz de…
-
0
votes0
answers97
viewsHow to access the i-th position of an array?
I have the following statement Define a stored stack in an array; a. Insert a widget at the top of the stack (push); b. Removing an item from the top of the stack (pop); c. Return the number of…
-
0
votes0
answers24
viewsJavascript: Change background and show selections in TEXTAREA resulting in error 405
Hello! This is the following exercise: Click on the go button: Change the background color Show selection of newspapers in the textarea When I click on the button, the page results in error 405. I…