mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-07 23:22:11 +01:00
33 lines
402 B
C
33 lines
402 B
C
/*
|
|
* @@name: private.1c
|
|
* @@type: C
|
|
* @@compilable: yes
|
|
* @@linkable: yes
|
|
* @@expect: success
|
|
*/
|
|
#include <stdio.h>
|
|
#include <assert.h>
|
|
|
|
int main()
|
|
{
|
|
int i, j;
|
|
int *ptr_i, *ptr_j;
|
|
|
|
i = 1;
|
|
j = 2;
|
|
|
|
ptr_i = &i;
|
|
ptr_j = &j;
|
|
|
|
#pragma omp parallel private(i) firstprivate(j)
|
|
{
|
|
i = 3;
|
|
j = j + 2;
|
|
assert (*ptr_i == 1 && *ptr_j == 2);
|
|
}
|
|
|
|
assert(i == 1 && j == 2);
|
|
|
|
return 0;
|
|
}
|