Share via


A.21 Scoping Variables with the private Clause

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

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.