-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
44 lines (34 loc) · 859 Bytes
/
main.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
#include <stdio.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <math.h>
#include "produtoPolinomial.h"
//Recebe os 2 vetores de polinomios, aloca eles na memoria e preenche com valores
void preenche_vetor(int** array1, int** array2, int size){
*array1 = (int*) malloc(sizeof(int)*size);
*array2 = (int*) malloc(sizeof(int)*size);
for(int i = 0; i < size ; i++){
(*array1)[i] = 2;
(*array2)[i] = 3;
}
return;
}
int main(){
int size = 128;
int grau_maximo = pow(2,17);
int *array1;
int *array2;
preenche_vetor(&array1, &array2, size);
//Inicia arquivos
FILE* saida = fopen("saida.txt", "w");
//Mede tempo de cpu
do{
calculaPol(size, array1, array2, &saida);
size*=2;
preenche_vetor(&array1, &array2, size);
}
while(size<grau_maximo);
//Fecha arquivos
fclose(saida);
return 0;
}