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.

397,043 questions
0votes
0answers
3views

How Do I Add Event Listener To An Array.foreac

[When I Hover On The Song Cover I Want To Change its src1 how to add eventlistener(onmouseover) to songitems
0votes
0answers
12views

Do javascript/react have double arrow operator inside array?

I have array like this: const arr2 = [ one => { 'Hello'; }, two => { 'Answer'; }, three => { 'LOREM IPSUM'; }, ]; If javascript have arrow ...
1vote
0answers
9views

how to move data input from user using HTML to index of array in PHP

i declared array score, and move data input HTML from user to array score PHP here <?php $score= []; if(isset($_POST['send'])){ for ($i = 0; $i < 2; $i++) $score[] = ...
0votes
0answers
12views

118 Leetcode| Pascals triangle| buffer overflow

I tried to solve this question on my own intuitively.The approach seems fine to me mostly however i am facing a stack overflow issue which i am not able to identify. Any help would be appreciated. My ...
0votes
2answers
23views

Why aren't these two strings equivalent? C [duplicate]

I'm currently working my way through CS50x and just tinkering around with some of the practice problems from Week 1 and testing the limits of my knowledge. Could someone help me understand why the two ...
-4votes
0answers
22views

How would you solve this? [closed]

Write a C++ program to solve the following problem: There a n lockers in a hallway, numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, ...
0votes
0answers
13views

how to convert jsonobject into jsonarray and also change all keys with all custom same keys java android

{"SILVERRohit":0,"DINRCosmic":20,"NATURALGASCosmic":0,"NGCosmic":0,"SICosmic":-5,"SILVERCosmic":35,"DINRRishi":0,"SIRishi&...
1vote
1answer
28views

How to print one element in a list at a time and not carry forward the previous one?

As you can see in the image, I'm trying to achieve the expected behavior but somehow cannot make it. I believe the error is come from for loop that I coded. I tried with break, but it's not what I ...
0votes
0answers
54views

cout printing strange numbers that don't exist

I am writing a program to read in two arrays, the first of length C and the second of length N. Then, it prints the two arrays. However, when my program prints the arrays, it prints strange numbers ...
0votes
2answers
42views

Print Value from array [duplicate]

I am doing project in Laravel. Given below is my output array Array ( [0] => Illuminate\Support\Collection Object ( [items:protected] => Array ( [0] => stdClass Object ( [u_id] => ...
1vote
1answer
15views

Search Nested Array with String (name) - Familty Tree Array

I have a big big array with contains names of People across 8 centuries and its quite huge, I want to build a search mechanism, that a user enters name and should search that nested array and also ...
0votes
4answers
45views

In c, when I use %s to print out the contents of a char array it prints blank, but when I loop over it and print each character it works

Just implementing a simple sorting algorithm to sort a string. I tried printing out the buff char array with printf("%s\n") but it came out blank. The contents of the array are there, though,...
-1votes
0answers
8views

Can't loop over Array created from Fetch() [duplicate]

I use Fetch() to retrieve data from an api end point. The data is fetched with no errors. The data is a record from a database. I want to use this data to dynamically build a HTML table. However, when ...
-2votes
0answers
8views

Get a list of user names from the list for users in the USA (javascript) [duplicate]

users = [ {"name": "bill", "age": 34, "country": "RUS"}, {"name": "susan", "age": 37, "country": "USA&...
-1votes
0answers
8views

How could I add all the values inside different objects to a single array [duplicate]

let obj0 = {orderNumber: 1, totalPrice: 20} let obj1 = {orderNumber: 2, totalPrice: 10} let obj2 = {orderNumber: 3, totalPrice: 50} let obj3 = {orderNumber: 4, totalPrice: 25.5} let obj4 = {...

153050per page