forked from viniciusvg/apa-quicksort-externo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vetor.c
50 lines (40 loc) · 762 Bytes
/
vetor.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include "vetor.h"
/*Imprime os elementos de um vetor.
@v vetor a ser impresso
@n tamanho do vetor a ser impresso
*/
void imprime_vetor(int *v, int tam)
{
int i;
for (i = 0; i < tam; i++)
printf("%d ", v[i]);
return;
}
int verifica_ordem(int *v, int tam)
{
int i;
for (i = 0; i < tam-1; i++)
if (v[i] > v[i+1])
return 0;
return 1;
}
void copia_vetor(int *src, int *dst, int tam)
{
int i;
for (i = 0; i < tam; i++)
dst[i] = src[i];
return;
}
void gerar_numeros(int *v, int tam)
{
int r,i;
srand(time(NULL));
for(i=0;i<tam;i++){
v[i] = rand();
}
return;
}