Questions tagged as 'array'

2
answers

How to split a string into array in JavaScript?

There is an elegant way to split a string into an array based on the example: var x = "FAT* FAT32*"; And that would result in something like this: x[0] = "FAT*"; x[1] = "FAT32*";     
asked by 22.01.2015 / 14:24
3
answers

How to play items with a specific value for starting an array?

I have an array questions [] with the following properties: perguntas[0] = { id:1; ordem: 3; inicio: 1 }; perguntas[1] = { id:2; ordem: 2; inicio: 0 }; perguntas[2] = { id:3; ordem: 1; inicio: 1 }; I would like to change them to order in t...
asked by 01.12.2014 / 14:30
2
answers

How to make a constant object in JavaScript

How do I declare a constant object in JavaScript? For example: /* meu código */ object_teste = {valor:5} /* console navegador */ object_teste.valor=10; console.log(object_teste.valor) // aqui ele me retorna 10 ao invés de 5 How to leave t...
asked by 12.03.2014 / 20:57
2
answers

Why declare pointer to array if arrays are already pointers?

If a char array is already a pointer, why declare a pointer to the array? And what's the difference between char exemplo[10] and char *exemplo[10] ?     
asked by 08.10.2015 / 03:19
1
answer

What is the difference between array_replace and array_merge?

I would like to know the difference between array_replace and array_merge , because in some cases the two seem to have similar behaviors. Example: $informacoes = ['nome' => 'wallace', 'idade' => 36]; array_replace($i...
asked by 01.04.2016 / 13:47
2
answers

Creating an array from two

I have the situation where I need to build a arrayC[] in Java from a arrayA[4] and a arrayB[7] , where arrayC[] must display arrayA[4] and then arrayB[7] : For example: arrayA[4] = {A0; A1; A2; A3}; a...
asked by 06.06.2018 / 19:04
2
answers

What will be the result of $ a?

I was studying PHP and seeing questions, to improve my knowledge in the area. Here is an excerpt of an issue:    Given a snippet of code written in the PHP language, like the one below: $a = array("a", "b", "c", "d"); $a[] = "e"; The...
asked by 18.08.2017 / 21:40
2
answers

Doubt about pointers

This code creates array, initializes and prints, as well as adding, subtracting and multiplying arrays: typedef struct{ int nl; int nc; int **elementos; }MATRIZ; void criar_matriz (int, int, MATRIZ *); void inicializar_...
asked by 11.03.2015 / 23:46
2
answers

How to make the jQuery toggle function in pure javascript?

I discovered a little time and found the toggle function very interesting using functions: $('body').toggle( function(){ alert('A') }, function(){ alert('B') } ); (In the example I put only 2 functions, I wanted...
asked by 11.02.2014 / 22:37
3
answers

How to sum the results of an array brought from the database in PHP?

I'm doing this, but what's being added is the number of rows and not the values of the "something" field. <?php $searc= mysql_query ("SELECT algo FROM lugar") or die (mysql_error()); while ($rows = mysql_fetch_array($searc)) { $soma_das_...
asked by 30.04.2014 / 15:32