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,344
questions
0
votes
0
answers
7
views
Passing an array to a function in C - array subscript vs pointer dereferencing [duplicate]
Coming from mainly Python and JavaScript
I (think I) understand that when you pass the name of an array to a function, the array is decayed to a pointer. The part that confuses me is the fact that the ...
-2
votes
0
answers
26
views
How do relationships not cause infinite loops?
So I'm still learning SwiftData and the one thing I cannot get my head around is how relationships don't cause infinite loops.
For example, using SwiftData, if you want to list all the films an actor ...
1
vote
2
answers
79
views
C++: array types and new
I'm learning C++. The following program looks nice and generic:
typedef some_type T;
int main() {
T* p = new T;
}
And it indeed works for non-array types like int, etc. However, if I try typedef ...
0
votes
0
answers
40
views
Best practice approach for dynamically loading and referencing large datasets [closed]
I have an analysis framework which operates on large datasets loaded from other workbooks. The sets comprise headered columns each containing a single metric, with multiple columns on each sheet and ...
0
votes
0
answers
6
views
How can we solve this Array to string conversion error in php 8
I have this below code from old theme file. When migrating this to PHP 8, exactly at this line ($$value['id'] = get_option( $value['id'] ); }) it throws an error - [error] 198034#198034: *334 FastCGI ...
-4
votes
0
answers
21
views
Copying bytes with step offsets from one array to another in VB.net [closed]
I have a large byte array that I want to transfer to a smaller array by copying every 6th byte. The VB.net array copy commands do not appear to offer a method of using offsets - is there a way around ...
0
votes
3
answers
57
views
Search for a pattern in a string array
Let's assume I have the following array:
string[] arr = ["Off", "Off", "Off", "Duty", "Off", "Off", "Duty", "Duty", &...
1
vote
2
answers
40
views
How to count values from a column with JSON content?
I have a table with singers and each singer can be linked to many musical styles.
Musical Styles are in a TEXT column, but the content of the column has JSON format.
I want to count the number of ...
1
vote
1
answer
136
views
Can't understand this C syntax. Designated initialization of an array of structs?
Trying to learn the nuances of C, though I was doing well until I found this:
#define SOKOL_IMPL
#define SOKOL_GLES3
#include "sokol_gfx.h"
#include "sokol_log.h"
#include "...
-1
votes
2
answers
50
views
C++ Rectangle 2D Array with numbers beside the rectangle
I've been trying to make a 2D array of rectangle, and i want the number of index x to printed beside the rectangle and index y to be printed below the rectangle..
Here is my code..
int height, width;
...
-8
votes
0
answers
28
views
How to get and sort a string from an array in javascript? [closed]
I have this array with this string:
['MEX-CUN'] ['MEX-MTY']
and I would like a result similar to this:
CUNMEX
MEXMTY
Is it possible to perform this action?
1
vote
1
answer
24
views
Import Array to Godot via CSV
I'm currently making a game in Godot using CSV tables to help keep track of things. Most stuff works, except when I want to import a column as an array. How would I format this array in a CSV so ...
-1
votes
0
answers
13
views
In excel I need a general set of instructions to derive certain sub arrays
enter image description here
Given an array of variable numbers of rows from 5 to 100 and columns from 5 to 26, an example of which is shown in image;
The columns may start in row 2 with a variable ...
0
votes
0
answers
24
views
How to import an array of rows while editing each row of the array
I have a complicated question
I have one table with a bunch of columns and rows. Then on other pages I import filtered data from the first page. That is, I group all the data into separate groups via =...
0
votes
1
answer
32
views
Find the average per index in a matrix
I'm looking to get the average of each index in a matrix row in JS
[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
Then returning a list with the average of each row index : [4, 5, 6]
Would I create a loop, save each ...
2
votes
3
answers
113
views
Converting to char*** from char* [2][2]
I have the following variable
char* a[2][2] = {{"123", "456"}, {"234", "567"}};
I wanted to refer it using another variable. While the cast works, accessing ...
1
vote
0
answers
36
views
Multiple adding to cart in JavaScript doesn't work
when I add products to the shopping cart at some point it stops updating the table, it is refreshed when I click the previous product and the product I want to add.
Live site: https://frontend-mentor-...
1
vote
0
answers
6
views
Warning: Undefined array key 0 releases/80/vendor/magento/module-configurable-product/Model/Product/Type/VariationMatrix.php on line 47
A configurable in the Product view opens up with the error message, of which I cannot proceed any further. The children attached can open up without issue. There were not any issues with opening up ...
0
votes
1
answer
22
views
LENGTH of ARRAY [42883]: ERROR: function array_length(text[]) does not exist
ON PostgreSQL 9.6.10 (Red Hat 4.8.5-28), 64-bit
select string_to_array('file.name.pdf', '.')
{file,nome,pdf}
select array_length(string_to_array('file.nome.pdf', '.'))
[42883]: ERROR: function ...
0
votes
1
answer
39
views
Checking a candidate majority element: Does my simplification work with all cases?
Here are the details of the problem:
Given a sorted array arr of N elements.
A majority element in an array of size N is an element that appears more than N/2 times.
The task is to write a function ...
0
votes
1
answer
28
views
CSV backslash create issue while procession file data
I am trying to process a CSV file in which one column contains JSON formatted data. In this JSON data, some fields use backslashes, which creates a problem when mapping fields with their values.
Link ...
-1
votes
3
answers
72
views
Todo list using array and loop
I want to create a todo list using array and loop and display the list in div container. I am able to display the list but it is muliplying the same list stored and is displayed.
<body>
<...
0
votes
2
answers
90
views
How to show String of array text in curve shape in SwiftUI?
I need array of text should scroll in curve shape like below:
Code: but with this code i can create green colour curve shape view but how to show array of text in curve shape ? please help me to ...
1
vote
3
answers
75
views
In C, why can a variable holding a char array be assigned to a pointer, but the address of the same pointer cannot?
Consider the following code:
char stringy[] = "There's too much confusion, I can't get no relief!";
char *pStringy;
pStringy = stringy;
This compiles -
stringy is an array of characters, ...
-1
votes
0
answers
17
views
How can I convert a multidimensional array from x by y to y by x? [duplicate]
Given the 3x2 multidimensional array:
const arr = [
[1, 3, 5],
[2, 4, 6]
]
where (1,2) === 2 and where (3,1) === 5 and etc
How can I convert it to the 2x3 multidimensional array:
const arr = [
[...
-1
votes
3
answers
42
views
Retrieve array data that every nested array contains
The main goal is to select all the colors that every car.colors contain, if there's no color that every car have then the expected output is an empty array.
Having an array that contains text, and a ...
-1
votes
0
answers
20
views
Output an object's value without looping [duplicate]
I'm trying to var_dump the guid value in this object without setting up a foreach loop. I think the ["2"] key is throwing me off. This data is coming from the Toast API. Any help would be ...
0
votes
0
answers
13
views
Google Earth Engine: error "Invalid type. Expected type: Number" trying to compute a Number while performing histogram matching on satellite images
I am working on satellite imagery on Google Earth Engine (JavaScript), and I'm experiencing some issues while I try to perform histogram matching on two images from two different time periods.
In ...
0
votes
1
answer
42
views
How to convert long hex string into byte array (0x69, 0x63, etc. etc.)
I have a long hex string (around 8000 bytes) that I want to convert into what I think is called a byte array. (Please be kind if I've got the name wrong.) In other words, the string begins
69636E etc.
...
0
votes
0
answers
38
views
Leetcode output is different from visual studio code output
I just started on my leetcode exercises and I ran into a bit of a problem. I usually work on the leetcode problems on vsc and then when I got my answer, i just copaste it onto the leetcode answer box.
...