Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Posts tagged array

Subtag of data-structures · 1 child tag

For questions about arrays, an ordered linear data structure consisting of a collection of elements identified by one or multiple indexes.

This tag doesn't have a detailed wiki yet.

80%
+6 −0
Q&A Can I access an array element from a pointer to an object contiguous with but outside the array?

C prohibits accessing an array out of bounds even if measures were taken to ensure that what should lie outside those bounds were known: struct MyStruct { int x[2]; int y, z; }; static...

1 answer  ·  posted 18d ago by CPlus‭  ·  last activity 15d ago by Lundin‭

62%
+3 −1
Q&A How do I remove an element from a Java array?

One way to remove element from array is to replace element with zero. Below is a rough snippet I am sharing: int N = sc.nextInt(); int pos = sc.nextInt(); int A[] = new int[N]; if(pos == i) { ...

1 answer  ·  posted 7mo ago by abhinavxyz‭  ·  edited 7mo ago by E_net4‭

Question java array
80%
+6 −0
Q&A When using the compare function in Array.prototype.sort, how to avoid an element to be processed more than once?

When using the Array.prototype.sort method, we can pass a compare function as argument. Then, this function can be used to process array's elements, so the comparison is made using some custom crit...

2 answers  ·  posted 2y ago by hkotsubo‭  ·  last activity 10mo ago by matthewsnyder‭

66%
+2 −0
Q&A How do I (compactly) initialize a 2-d array of structs with the same value?

I learned about the ** operator for array-repeat, and I love it. I have a struct that contains a 2-d array of inner structs, like const D1 = 30; const D2 = 40; const Inner = struct { .a: u32, ....

0 answers  ·  posted 1y ago by aghast‭

80%
+6 −0
Q&A array of arrays vs array of pointers to store array of string literals

Let's consider the following code: const char a[][4] = {"aa", "aaa"}; const char *b[] = {"bb", "bbb"}; const char *const c[] = {"cc", "ccc"}; For shared libraries, both b and c arrays require...

0 answers  ·  posted 2y ago by alx‭  ·  edited 2y ago by alx‭

28%
+0 −3
Q&A What is [{options}] in JavaScript?

I am trying to understand this code: const iframes = iFrameResize( [{options}], [css selector] || [iframe] ); The code can be found in this documentation. Is [{options}] an array of objects an...

1 answer  ·  posted 2y ago by deleted user  ·  last activity 2y ago by hkotsubo‭

71%
+3 −0
Q&A Why does pushing to one array affect all the arrays in my two-dimensional array?

I was trying to initialize a simple two dimensional array as follows: const arrays = Array(3).fill([]); However, when I tried to push an entry into one of the arrays, it seems like it gets push...

1 answer  ·  posted 2y ago by Moshi‭  ·  last activity 2y ago by Moshi‭

Question javascript array
66%
+2 −0
Q&A Difference between puts and print for Array

I have an array friends = Array.new friends[0] = "Mad man" friends[1] = "hey" There's two ways to print it (using print or puts). At first I tried print print friends which gave: ["Mad...

1 answer  ·  posted 3y ago by deleted user  ·  edited 2y ago by Trilarion‭

Question ruby array output
77%
+5 −0
Q&A Kotlin FloatArray from Iterable<Float>

Suppose I am using a Java API from Kotlin and I want to call a function that takes a FloatArray (represented as float[] in Java), and I have an Iterable<Float> as my input data type. To be mo...

1 answer  ·  posted 2y ago by Josh Hyatt‭  ·  edited 2y ago by Alexei‭

Question array kotlin iterable
75%
+4 −0
Q&A Get the length of a slice from a multi-dimensional array

If I have a one-dimensional array, I can get the length of it quite easily: var x = moves.Length(). However, if the array is multi-dimensional, .Length() returns the total number of elements. If ...

2 answers  ·  posted 2y ago by FrankLuke‭  ·  last activity 2y ago by FoggyFinder‭

80%
+6 −0
Q&A How to read lines into an array in Bash

I wish to fill an array with strings, using Bash scripting. The strings are in a file, one per line. Here is what I've tried: declare -a my_array=() while read line; do my_array+=( "$line"...

3 answers  ·  posted 3y ago by LVx0‭  ·  edited 2y ago by Alexei‭

Question array bash console stdin
42%
+1 −2
Q&A How do I filter an array in C?

No, I'm not trying to get the full program written completely in C by you guys. I only need some way to implement the functionalities of each function I found confusing. In this challenge in Code ...

2 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by Derek Elkins‭

Question c javascript array
60%
+1 −0
Q&A Permutations of an array - APL

In Dyalog APL, there's a predefined function in the dfns library to generate a matrix of permutations for a list of the numbers from 1 to n. I want to create the same functionality, except that it...

1 answer  ·  posted 3y ago by Razetime‭  ·  edited 3y ago by Alexei‭