Questions tagged as 'array'

2
answers

Compare arrays

Good afternoon. I would like to know how I can be comparing two arrays and saving each pair of found values and printing the numbers that were unparalleled. Ex: a) 1,2,3,4,5     b) 1,3,5,6,7,5,3 It would hold the pairs (1,1) (3,3) (5,5)...
asked by 29.03.2016 / 20:10
1
answer

Function reverses numbers in array

How does this function work in c that inverts the numbers? void inverte(int vetor[MAX], int n) { int i,aux; for (i = 0; i < n/2; i++) { // troca posicao i por n-1-i aux = vetor[i]; vetor[i] = vetor[n-1-i]; vetor[n-1-i]...
asked by 04.03.2016 / 00:58
2
answers

Vector that generates elements

I would like to generate a vector where its next position element is added by 1. For example: be vetor[3] , I'd like v[0] = 1 and v[1] = v[0] + 1 , v[2] = v[1] + 1 , and so on. How would you do that? Follow my code fo...
asked by 07.11.2016 / 18:42
1
answer

Could you help me with MergeSort?

I'm having trouble compiling the MergeSort sorting method. #include <stdio.h> #define TAM 10 void intercalar(int vet[],int aux[],int ini1, int ini2,int fim2) { int in1=ini1,in2=ini2,fim1=in2-1,au=0,i; while(in1<=fim1 &&am...
asked by 15.11.2016 / 05:58
2
answers

Extensive array causes the program to stop working

I have the following problem, when I define an array that is too large, for example: int matriz[2000][2000] , compile and command to run, the program stops working. I just tested it in Windows and it appears that classic message ".exe has...
asked by 10.10.2015 / 15:11
3
answers

What is the purpose of array_map to accept infinite array parameters after callback?

I usually use the array_map function to be able to do something similar to% list comprehension of python Something like: $meses = function($mes) { return sprintf('02%s/%s', $mes, date('Y')); } $arrayFormatado = array_map($m...
asked by 22.10.2015 / 15:57
1
answer

$ _REQUEST values returning null [closed]

I have the following form that sends an array: Form: <form id="form-simulacao" action="controller.php"> <div class="col-md-3"> <div class="form-field"> <div class="form-group">...
asked by 02.09.2016 / 20:16
2
answers

How to transform array into string with php

item 1 - How do I do this? Array ( [0] => Array ( [0] => 2 [1] => 4 [2] => 5 [3] => 6 [4] => 7 [5] => 9 ..........
asked by 05.08.2017 / 04:09
2
answers

How to display certain position of an associative array?

This is my associative array : $vetor = array( "Nome"=> "posicao1", "Telefone"=> "posicao2", "Idade"=> "posicao3", "Sexo"=> "posicao4" ); To display the contents of it, I can use foreach() ; foreach($vetor as $campo...
asked by 12.05.2016 / 16:27
3
answers

Check the existence of the values of an array in the keys of another

I have two arrays: $ keys Array ( [0] => Array ( [0] => {3} [1] => {1} [2] => {2} [3] => {0} [4] => {4} [5] => {5} ) );...
asked by 12.07.2016 / 18:25