Compartir a través de


A.21 Scoping Variables with the private Clause

The values of i and j in the following example are undefined on exit from the parallel region:

int i, j;
i = 1;
j = 2;
#pragma omp parallel private(i) firstprivate(j)
{
  i = 3;
  j = j + 2;
}
printf_s("%d %d\n", i, j);

For more information on the private clause, see Section 2.7.2.1 on page 25.