Skip to content

Commit 6fe24b0

Browse files
committed
main function added
1 parent 30183be commit 6fe24b0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

merge_omp.c

+20
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,23 @@ void printArray(int arr[], int size)
9090
printf("%d ", arr[i]);
9191
printf("\n");
9292
}
93+
/* Driver program to test above functions */
94+
int main()
95+
{
96+
97+
int arr[MAX],i;
98+
srand(time(NULL));
99+
for(i=0;i<MAX;i++){
100+
arr[i] = rand() % MAX;
101+
}
102+
clock_t t1,t2;
103+
t1 = clock();
104+
mergeSort(arr, 0, MAX - 1);
105+
t2 = clock();
106+
double t_time = (double)(t2-t1)/CLOCKS_PER_SEC;
107+
printf("Sorted array: \n");
108+
printArray(arr, MAX);
109+
printf("\t\tTime Elapsed: %.5f\n",t_time);
110+
return 0;
111+
112+
}

0 commit comments

Comments
 (0)