openmp.c 284 B

123456789101112131415
  1. /* build with: gcc -fopenmp openmp-test.c -o openmp-test */
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <omp.h>
  5. int v[10];
  6. int main(void) {
  7. #pragma omp parallel for
  8. for (int i=0; i<10; i++)
  9. v[i] = i;
  10. printf("first: %d, last: %d\n", v[0], v[9]);
  11. return 0;
  12. }