Questions tagged as 'array'

1
answer

I can not print, in the main function, values coming from a vector created in another function received by a double pointer

The following source code is the miniaturization of a major problem that I am working on, and I have not been able to solve the problem for two days. I need to print the values of the vector generated by the "makeVector" function, in the "mai...
asked by 03.06.2018 / 21:05
1
answer

Store the positives in one vector and the negatives in another

   Make an algorithm that reads a set of 30 integer numeric values and distributes them between two vectors, separating the positive numbers from the negative ones. The vectors must have 30 positions each. Show the vectors at the end of processi...
asked by 28.07.2018 / 22:59
2
answers

Replace list () by putting value in each index of an array

So I was browsing through php.net when I came across List () and went to see what it was for. Then they gave me the following example: $info = array('Café', 'marrom', 'cafeína'); list($bebida, $cor, $substancia) = $info; echo "$bebida é $cor e...
asked by 14.03.2017 / 14:16
1
answer

Loop is within loop for

for(pass = 0; pass < size - 1; pass++){ for(j = 0; j < size - 1; j++){ if(array[j] > array[j + 1]){ swap( &array[j], &array[j + 1]); } } } I just put a piece of code where I have a doubt...
asked by 18.01.2017 / 03:08
1
answer

How to add the diagonal of an array in C?

Help me in the following exercise: Make a program that defines an array of 5x5 size integers. Then, initialize this array with random numbers between 5 and 9. Finally, your program must calculate the sum of the diagonal elements of that matri...
asked by 05.05.2016 / 01:05
2
answers

Final value of the array?

This my life: $valor = $cliente->cobrancas[1]->valor; echo '<pre>'; print_r($cliente); echo '<pre>'; Print the values below: stdClass Object ( [id] => 24151 [nome] => PAULO ANDRE ROCHA MOTTA [endereco] =>...
asked by 16.05.2016 / 15:58
2
answers

Laravel - Session and Array

I need to create an array: array( 0 => 0, 1 => 0, 2 => 1, 3 => 0, 4 => 0, 5 => 1, 6 => 0) within a session: session('session_array') and then individually add and retrieve the values according...
asked by 13.05.2016 / 17:15
1
answer

select on elements that are not in array [duplicate]

I have an array in PHP with IDs: $idNaoEnvia['1', '3', '6'] And a table named account in MYSQL: ID | NOME 1 | caio 2 | antonio 3 | cleber 4 | marcos 5 | leonardo 6 | andre I wanted to use PDO to give a select in the a...
asked by 23.08.2016 / 00:08
1
answer

Sort array alphabetically and show only first name of each item

I am totally a layman in Java, I wanted help in completing an exercise. The statement is this:    "write a program that receives an array with the name   complete of 10 people and present an array with only the first name   of each person...
asked by 28.08.2016 / 19:47
1
answer

PHP - pushing array into another array

I'm trying to make a array inside another and include more data in array inside, how do I do that? Follow the code of the attempt, it is to generate a json : $data = array( "login1" => "login1", "login2" =>...
asked by 21.07.2016 / 18:24