Questions tagged as 'array'

2
answers

Grouping and adding array with PHP

I need to know how to group and add array , but I'm not sure how to do it. $array = array("vermelho", "vermelho", "vermelho", "verde", "azul", "azul"); I wanted a return like this 3 1 2 That is, it will group and add up the amoun...
asked by 08.01.2014 / 00:06
2
answers

char [] or * char malloc?

What difference in C between char text[10] or char *char = (char *)malloc(10*sizeof(char)); What advantage of using malloc on a pointer?     
asked by 21.07.2016 / 20:10
2
answers

How to allocate dynamically when I do not know how many positions I will use in C?

In a part of the code I need to transform an integer into binary and store it in a vector of characters, however, I do not know which integer I'm going to get to binary, so I do not know how many positions my vector will have %. How to handle...
asked by 31.08.2015 / 02:56
5
answers

How to create a vector without determining its size in java?

I have a TesteAplicacao class that is to test and a Teste class with attributes and methods. When creating a vector in Java: Teste[] t = new Teste[10];// veja que teve definir um tamanho Would you like to create vector wit...
asked by 03.03.2016 / 17:24
2
answers

Remove more than one item from an array

You can remove more than one item from an array at a time. Follow the code: var teste = [6,4,5]; //meu objectivo é remover os itens 4, 5 por ex //removendo o item 4 teste.splice(1, 1) //removendo o item 5 teste.splice(1, 2) As you can...
asked by 12.02.2015 / 18:50
6
answers

How do I transform an array that is in a string to array in javascript?

I have a string representing an array as follows: var = "['aaaaa', 'bbbbb', 'ccccc', 'ddddd']"; I want to be able to transform this array that is in the string into an Array to perform manipulations. var = ['aaaaa', 'bbbbb', 'ccccc', 'ddd...
asked by 31.03.2017 / 16:27
1
answer

Is there an associative array type data structure in Java?

Well, I'm trying to name an Array of Strings in Java, but I wanted it to be, for example: String[] symbols; And that could be stated like this: symbols["name"] = "Tiago"; I know that Array does not exist like this, but in some other wa...
asked by 13.01.2015 / 22:10
7
answers

Mapping an array with possible subarrays as elements

I'm trying to create a function that maps an array to another newArray. If one of the array elements is a array , I want to map all of its subelements to newArray. Therefore: var array = [1,2,3,4,5, [1,3,2,4,1]] Should return   ...
asked by 18.06.2015 / 19:38
5
answers

Remove last comma from an array

In this code below I have an array that returns me a comma at the end  exe: '98602', '98603', '98604', How can I remove this comma? if (isset($_POST['checkbox'])) { foreach ($_POST['checkbox'] as $key => $value) { $id = mysql_re...
asked by 06.03.2015 / 16:09
4
answers

How to do a search to know if a string is inside a vector in C #

I'm doing a small program that does search within a vector. The problem I am having is that if it finds the name it gives a message saying it was found but then it gives another message saying that it was not found, the code I am creating is thi...
asked by 30.05.2017 / 10:09