Questions tagged [arrays]
An array is an ordered linear data structure consisting of a collection of elements (values, variables, or references), each identified by one or more indexes. When asking about specific variants of arrays, use these related tags instead: [vector], [arraylist], [matrix]. When using this tag, in a question that is specific to a programming language, tag the question with the programming language being used.
arrays
417,301
questions
0
votes
1
answer
28
views
How to create a generic array in GO?
I have a function that needs to receive a GORM model as a parameter, and depending on the model I receive as a parameter, I need to create an Array(Slice) based on the type of the struct(gorm model) I ...
0
votes
0
answers
9
views
Create mysql table from json string when 1st dimension hold columns and 2nd dimension holds rows
I am sitting with a legacy database and im trying to create this table in mysql using json strings stored in the database.
I have a table that stores a massive json string and one of the keys inside ...
1
vote
1
answer
23
views
How do i use "my" to declare array and element in perl?
If I have an array, say @test and refer to items in the array as $test[0], etc. how should a my statement look? one of the following?
my (@test,$test); # array and element
my (@test); #just the array
...
-4
votes
1
answer
30
views
An ordinary numpy array produces a type error? [closed]
Could someone explain why I get this warning
<>:18: SyntaxWarning: list indices must be integers or slices, not tuple; perhaps you missed a comma?
and this error message
TypeError ...
1
vote
1
answer
27
views
Resolve Multidimensional Array using Javascript
When I do.
I receive as the screenshot attached.
But I need one array having each array as a whole number.
'use strict'
const { helper, browserstackBase } = require('@core/IQAir')
const webdriver = ...
0
votes
1
answer
31
views
How do I print data to table rows from multiple arrays within a larger array retrieved from an API?
I cannot think of the most apt way to phrase this question, so please forgive me if this description doesn't fully match the title. For context, I am working on an NFL database presentation site that ...
0
votes
1
answer
35
views
How to use `static` with an array of array in C
Given,
int last(int arr[3][6]) {
return arr[2][5];
}
I want to make it clear that arr can't be null with the static keyword.
The problem is that the following code won't work.
int last(int arr[...
-1
votes
1
answer
22
views
Sorting with AlgoBuild. Why do I get an index is out of range error?
I am using AlgoBuild to make a program that sorts numbers.
This is my attempt:
AlgoBuild translates this chart to the following pseudo code:
PROGRAM main
INPUT int D
FOR i = 0; i < D; i = ...
-2
votes
2
answers
39
views
How can I get last three values from array of objects
I have an array of object with a few values. I would like to get only last, three values (ownerSurname, color and bark).
I tried to use slice or length but with failure.
const myValues: MyValues<...
-2
votes
0
answers
25
views
Warning: Trying to access array offset on false in .... on line
function fc_table_one($table, $when, $id, $value)
{
global $db;
$db->connect();
$res = $db->selectOneData($table, '*', $when."='".$id."'");
return $res[$...
1
vote
1
answer
56
views
C# generic method detect if T is array and then index into the array
I'm trying to write a Dbg debug function that will print out some debug info about the given parameter and then return it. I would like arrays to be printed as the list of elements, and scalars to ...
-2
votes
0
answers
25
views
How to find the index of an item in a two dimensional array with the most unique values surrounding it
Given a square two dimensional array of a fixed size, say 100x100, with integer values ranging from 1-16, how would you go about finding the index/indices of a point/points with the most amount of ...
0
votes
1
answer
39
views
Why does this allocatable array cause an error?
I don't entirely understand allocation, so this may be a simple problem, but I wrote this Fortran code:
program name
implicit none
integer :: A, B
integer, dimension(:), allocatable :: ARR
...
2
votes
2
answers
67
views
How do I remove random elements in one-go from an array using splice in Perl?
I have an array as below :
my @arr = qw (ram sam ham dam yam fam lam cam)
I want to remove sam , yam and lam from the above array using splice.
I am using below code to do it :
# first getting the ...
0
votes
0
answers
24
views
How can I export click event callbacks that use React state from within a component?
I'm building a Dashboard to visualize a few NLP experiments.
Here's a snippet from the Dashboard component (.tsx) I've currently written:
import { Dispatch, SetStateAction, useEffect, useState } from &...