How are we doing? Please help us improve Stack Overflow. Take our short survey

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 which is specific to a programming language, tag the question with the programming language being used.

Filter by
Sorted by
Tagged with
0
votes
0answers
7 views

Convert string to php array keys dynamically

So, if I have this string taxonomy.universal_descriptive_taxonomy and I need to append taxonomy and universal_descriptive_taxonomy as keys to an existing array like this: $data['taxonomy']['...
0
votes
0answers
18 views

Using an empty space in the guard of an if statement for an Array in C [duplicate]

I'm taking my fist steps in programming and i was trying to make a program that takes as imput your username and and prints it out as output. I wanted to implement an if statement that triggers when ...
-3
votes
0answers
26 views

Divide array into two equal arrays with specific conditions in Javacript [closed]

Divide the countries array into two equal arrays if it is even. If countries array is not even , one more country for the first half. const countries = [ 'Albania', 'Bolivia', 'Canada', '...
-3
votes
1answer
19 views

Which of the functions is faster in terms of the execution time? beta() or alpha()?

Which would you expect to be faster? (Assume that arrays a[100] and b[100] are initialized globals) void beta(){ int i; for (i=0;i<100;i++){ a[i] = a[i] + b[i]; } } void alpha(){...
0
votes
0answers
15 views

Javascript:: Multidimensional array get all options keys

I want to create a menu with all available options from my multidimensional array. <!DOCTYPE HTML> <html> <head> <meta charset=utf-8> <title>&nbsp;</title> <...
0
votes
1answer
17 views

C - passing array in function an get its size [duplicate]

I am a Python user for quite a time now and now try to get into C. While Python does a lot in background for me i now have to code in C in a much more 'BASIC' way. I like it,... but its hard. The ...
0
votes
2answers
21 views

I can not push objects into nested array

I am have a problem that I am not able to push the object into the nested array. Please help thank you! Here is my code: let obList = [ { date: '12/1/2011', reading: 3, id: 2055 }, { date: '13/...
-3
votes
1answer
38 views

Having problems with loops and arrays [closed]

I did this simple loop but it doesn't work, do you know why? #include <iostream> using namespace std; int main() { int array[100], i=0; do { cin >> array[i]; i++; ...
0
votes
3answers
24 views

How to dynamically build a javascript Object and push into Array within nested loop?

I'm trying to dynamically build Objects and push them one by one into an Array. My code so far is this: matrix([[0,1,1], [1,00], [1,1,1]) const matrix = (sequence) => { const rows = {} const ...
0
votes
0answers
17 views

Why is my array doing the push function before the console.log before it is supposed to in the code? [duplicate]

I am experiementing with an array function, and my code looks like this: var myArray; myArray = ["a","b","c"]; function setup() { console.log(myArray); myArray.push(&...
0
votes
1answer
20 views

PostgreSQL: Update multiple rows in table with a single query

Suppose I have a table Car. This table has the following columns: id(uuid), status(text), color(text). I have pushed all the Car ids that have a specific color into an array: Suppose I have an array ...
1
vote
1answer
28 views

Is there a vectorized approach to reverse an n x m numpy array and shift the front end zeros to the back

Suppose A = np.array([1,0,2,0,0,0,0],[1,2,0,3,5,0,0],[5,6,7,0,9,5,10]) From A I'm trying to create B such that: B = np.array([2,0,1,0,0,0,0],[5,3,0,2,1,0,0],[10,5,9,0,7,6,5]) In other words B is A ...
0
votes
0answers
8 views

How to bypass IP limit import data from website to google sheet

Is it possible to bypass the limit of apikey from specific website in google sheet? currently I want to import data from website by IMPORTDATA function build in google sheet but the website has the ...
4
votes
2answers
26 views

Is there a way to multiply the 2d matrices of a 3d array by a scalar in R?

I have a 2x2x10 array of identity matrices, created with arr = array(diag(2), dim=c(2,2,10)) I'm looking to multiply each 2x2 matrix within that array by a scalar c(1:10) z = arr[,,1:10] * c(1:10) ...
0
votes
0answers
7 views

nested array in formgroup giving error: this.validator is not a function

i am trying to limit users to vote only once on a forumpost. i have been struggling with correctly using arrays to handle this functionality in angular for a while now. right now my code is failing ...

15 30 50 per page
1
2 3 4 5
23317