-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
42 lines (32 loc) · 911 Bytes
/
main.c
File metadata and controls
42 lines (32 loc) · 911 Bytes
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
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include "multisort.h"
#include "merge.h"
int main()
{
int N;
int *A;
int *temp;
printf("Type how many numbers you want to sort: ");
scanf("%d", &N);
A=(int *)malloc(N*sizeof(int));
temp=(int *)malloc(N*sizeof(int));
for(int i=0;i<N;i++)
{
printf("A[%d]=", i);
scanf("%d", &A[i]);
}
printf("\"A\" array before multisort...\n\t");
for(int i=0;i<N;i++)
printf("%d ", A[i]);
printf("\n");
#pragma omp parallel shared(A)
#pragma omp single
multisort(&A[0], &temp[0], N);
printf("\"A\" array after multisort...\n\t");
for(int i=0;i<N;i++)
printf("%d ", A[i]);
printf("\n");
return 0;
}