fork download
  1. #include <omp.h>
  2. #include <stdio.h>
  3. #define N 10
  4.  
  5. int main(){
  6. int v1 = 5, v2 = 10;
  7. #pragma omp parallel for firstprivate(v1,v2) lastprivate(v2) num_threads(2) schedule(static,2)
  8. for (int i = 0; i < N; i++){
  9. v1++;
  10. v2 = i;
  11. }
  12.  
  13. printf("v1 = %d, v2 = %d", v1,v2);
  14. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
v1 = 15, v2 = 9