Commit 2beeb9bb authored by Alejandro E. Rendon's avatar Alejandro E. Rendon
Browse files

Change malloc

parent be4c1088
......@@ -23,7 +23,7 @@ void add(int *a, int *b, int *c, int n) {
}
void addOmp(int *a, int *b, int *c, int n) {
#pragma omp parallel for
#pragma omp parallel for
for (int i = 0; i < n; i++)
c[i] = a[i] + b[i];
}
......@@ -36,9 +36,9 @@ int main(int argc, char const *argv[]) {
int *a, *b, *c;
double begin, end;
a = (int *)malloc(vec_size * sizeof(int));
b = (int *)malloc(vec_size * sizeof(int));
c = (int *)malloc(vec_size * sizeof(int));
a = new int[vec_size];
b = new int[vec_size];
c = new int[vec_size];
fillVec(a, vec_size, 10);
fillVec(b, vec_size, 10);
......@@ -58,9 +58,9 @@ int main(int argc, char const *argv[]) {
//print("c = ", c, vec_size);
free(a);
free(b);
free(c);
delete(a);
delete(b);
delete(c);
}
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment