Questions tagged as 'array'

5
answers

Remove all elements from an array that already exist in another

I have two arrays with objects in javascript: var a = [{objeto1}, {objeto2}, {objeto3}, {objeto4}, {objeto5}]; var b = [{objeto1}, {objeto2}]; How can I do what is in the array b exit the array a ?     
asked by 18.05.2017 / 19:56
2
answers

How to traverse an array by skipping some indices?

Is there a native way of doing this? for (var i in vetor) { for (var j in vetor) { if (i == j) { // pula o i break; } } } Is there any way to skip i within the parentheses of the second...
asked by 08.09.2017 / 16:26
2
answers

How to convert a yaml to PHP array?

How could I do to convert yaml data to a array of PHP? Example yaml: Usuario: nome: Wallace idade: 25 linguagens: - PHP - Python - Javascript     
asked by 28.08.2015 / 18:14
2
answers

How to create array dynamically?

I would like to dynamically create a array , I tried this way: $zt = array(); $zt = ($p_p[0] => $_p_p[1]); print_r($zt); $p_p is an array , where index 0 is the name, and index 1 is the value, 2 name, 3 value .. $p...
asked by 16.03.2015 / 17:57
3
answers

About inserting names into a vector. The user places the course name as argument in the method

I have this method: public void inserirCurso(String nome){ System.out.println(" Cadastre seus cursos aqui."); for(int totalCursos = 0; totalCursos < cursos.length; totalCursos++){ cursos[totalCursos] = nome; } } I'...
asked by 20.01.2016 / 18:18
3
answers

Changing the size of the vector in a structure

I have the following structure: struct Implicantes{ int posicao; char binario[5]; bool dontcare; bool tick; struct Implicantes *Next; }; Is it possible to change the size of the vector of char "binary" from 5 to t...
asked by 24.07.2016 / 20:44
2
answers

Which of these three codes is most recommended in memory and speed?

I would like to know which of these codes would be most recommended for speed, since all three do the same job: 1 $rand_length = 1; $rand_rules = range(0, 9); shuffle($rand_rules); $rand_rules = array_slice($rand_rules, 1, 9); $uni_id1 = ""...
asked by 03.02.2015 / 00:00
2
answers

Access indices of an array that is inside another array

I have the array below and I need to create a foreachs to go through it and get the product and qtd. $array = array( array( 'loja' => 'Loja1', array( array( 'p...
asked by 30.01.2018 / 21:08
2
answers

Count row in matrix that has repeated numbers

I would like to add the number of lines to linhaPreta with only 0, and the linhaBranca with only 1. public class Pixel { public static void main(String[] args) { int[][] img = { { 1, 1, 1, 1, 1, 1, 1, 1 },...
asked by 11.12.2014 / 18:43
2
answers

Use of conditions in arrays

I need to make a program that reads a 4X4 matrix and then sums the values in each row and then each column. I'm not sure how to define my condition. #include <stdio.h> int main() { int valores[4][4]; int i,j, somacol, somalin; for(i=0;...
asked by 27.09.2015 / 03:52