Questions tagged as 'array'

5
answers

indexOf does not find element in an array

The indexOf() is returning -1 even though I have this element, I'm doing this: pessoas = []; pessoas.push({"nome": "Pedro"}) pessoas.push({"nome": "João"}) pessoas.push({"nome": "Maria"}) pessoas.push({"nome": "José"}) console.log(pess...
asked by 30.10.2018 / 20:11
3
answers

How to display a multidimensional array without using a loop?

When trying to execute the following snippet: int[] vetor = {1, 2, 3, 4, 5, 6}; System.out.println(Arrays.toString(vetor)); The array is normally displayed as [1, 2, 3, 4, 5, 6] but if I try with a two-dimensional array, as follows:...
asked by 14.01.2017 / 14:28
1
answer

Retrieving list list values in python

I've tried several things and still can not figure out what the problem with my code is, it's a simple code. With numpy I put the txt values in the arrays array and I want to make some copies for two other lists, mensagem and no ....
asked by 22.09.2015 / 19:05
3
answers

Are objects similar to arrays?

Objects are arrays in JavaScript? I have difficulty understanding how this is possible: var obj = { title: 'some value' } console.log(obj['title']); // some value In my conception the use of brackets is only possible in lists to pass a...
asked by 08.04.2016 / 19:20
3
answers

How can I check if the last position of the array has been filled?

How can I check if the last position of the array has been filled? I tried the array_pop function but it seems to cut the array element, I just want to check if at the last position of array there is something ...     
asked by 20.09.2016 / 21:06
5
answers

How to return the sum of numbers of an array with indices of value greater than or equal to 2

I have the following array: array[0,2,0,0]; I need to create a function that adds only the indexes with values greater than or equal to two, how should I proceed?    In this example I should return 2;       array [0,2,0,0];       In thi...
asked by 01.11.2016 / 18:37
2
answers

Catch the index of a value in an array

How do I get an index of a value from my array ? For example: char[] letras = new char[]{'a','b','c','d'}; In letras , I would like to get the index of the value b for example. How do I do this in C #?     
asked by 01.09.2018 / 15:03
2
answers

How to create an infinite array?

I have a problem and I need to create an infinite, or rather undefined, array, so that I can enter as many data as I need ... How could I do it? I'm using JDK6.     
asked by 04.04.2014 / 11:51
2
answers

What is happening in my C program?

I just have to add the lines but the values do not make sense: Hereisthecode:#include<stdio.h>#include<stdlib.h>intmain(){intmatriz[6][6],i,h,somalinha[6];for(i=0;i<=4;i++){for(h=0;h<=4;h++){printf("Digite os valores de uma...
asked by 12.12.2016 / 04:56
3
answers

Assemble a single string with several strings of an ArrayList in Java

How can I get multiple Strings from an ArrayList in a simplified way and merge into just one string variable? I'm new to Java and I'm having trouble completing this change in a simplified way, avoiding long, unnecessary lines of code. List<...
asked by 17.06.2015 / 22:21