Skip to main content

Questions tagged [array]

An array is a systematic arrangement of similar objects, usually in rows and columns.

0 votes
1 answer
128 views

Elegant way in C to store many parameters with default value and current value in embedded flash

I'm programming an embedded system that has a number of user configurable parameters, which are stored in flash memory. I have to store a default value for each parameter as well as the user settings. ...
jusaca's user avatar
  • 175
0 votes
1 answer
331 views

Array structure for nested grouping (JavaScript)

I am currently struggling with how to solve nested grouping of data. The initial structure is given and my grouped structure below as well as my approach can be adjusted. My idea was to have the array ...
Dollique's user avatar
  • 101
21 votes
5 answers
16k views

How can Rust be "safer" and "faster" than C++ at the same time?

I have been told that Rust is both safer and faster than C++. If that is true, how can that be even possible? I mean, a safer language means that more code is written inside the compiler, right? More ...
euraad's user avatar
  • 335
-2 votes
3 answers
131 views

What are the pros and cons of different combinations of objects and arrays for data storing?

From the article JavaScript 2D Array – Two Dimensional Arrays in JS, I see one way to store data is to put all properties of each element into one array: let dataRepresentation1 = [ ['John Doe', ...
Ooker's user avatar
  • 315
4 votes
4 answers
676 views

When should tuples be used as an argument instead of an array?

I hope this isn't too off-topic/opinion-based, I'm new here. I want to pass three elements of the same type into a function. The three elements are unique cards of a deck of cards, so they're not ...
David's user avatar
  • 59
0 votes
3 answers
954 views

What prevents Java from having immutable primitive arrays?

Java never had immutable primitive arrays. However Java does have an immutable List or Map or other collection classes and of course final primitive fields and variables. In Java if you try to make an ...
CPlus's user avatar
  • 1,189
5 votes
2 answers
2k views

Why does C not support direct array assignment?

In C you cannot assign arrays directly. int array[4] = {1, 2, 3, 4}; int array_prime[4] = array; // Error At first I thought this might because the C facilities were supposed to be implementable with ...
CPlus's user avatar
  • 1,189
0 votes
3 answers
109 views

How multiple type lists are stored in memory?

Arrays are stored in a linear fashion, with memory cells of fixed size for each element. To have fixed sized memory cells Arrays should be homogenious. So in Arrays we get an Nth element by skipping ...
forty5's user avatar
  • 39
4 votes
2 answers
2k views

Multidimensional vs nested arrays

A seemingly basic question here. Is there anything you can do with multidimensional arrays that you can't do with nested arrays? Many languages have been designed with both facilities and syntactical ...
Steve's user avatar
  • 9,272
0 votes
0 answers
50 views

JavaScript: My logic traversing multi-dimensional arrays

Consider the following: Let's say below is the multi-dimensional, and you are given the starting point of [2, 2]. const WORLD = [ ['P', 'P', 'P', 'C', 'P'], ['P', 'M', 'P', 'C', 'P'], ...
Antonio Pavicevac-Ortiz's user avatar
0 votes
0 answers
100 views

Best choice for a holding large number of objects in java

I have a set of array, containing a large number of objects (products), which has lately grown so large, searching in it takes about a minute, which is considered too long, since one search is ...
kry's user avatar
  • 101
2 votes
2 answers
2k views

JS - two array filters vs. one forEach?

I've had a question for a while. I know that the Array prototype method filter is generally preferred over forEach, and I believe it is typically faster at the job as well. But what about if I have ...
Michael Jay's user avatar
2 votes
1 answer
2k views

Do C++ compilers optimize/pack small data types (e.g. boolean values)?

This occurred to me when looking at stencil computations in numpy. This python library compiles compute-intensive components, so I believe that it's a valid example. Here making selections on an array ...
Daniel Krajnik's user avatar
-2 votes
2 answers
908 views

Comparing and replacing values in an array [closed]

I am currently working on a program that replaces the value in an array if the value next to it is the same as the current value. So If the array is [0,0,0,1,0,1,0], when the program runs it'll turn ...
Y3LLZ's user avatar
  • 13
4 votes
2 answers
1k views

Arrays vs Maps for listing items that have a unique id

I've been finding that for a lot of code I've been writing recently, it naively might look like this: Array approach: const options = [ { id: 'red', label: 'Red', data: '#f00' ...
dwjohnston's user avatar
  • 2,563

15 30 50 per page
1
2 3 4 5
15