openmp.c 296 B

12345678910111213141516
  1. /* build with: gcc -fopenmp openmp-test.c -o openmp-test */
  2. #include <omp.h>
  3. #include <stdio.h>
  4. #include <stdlib.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. }
  11. printf("first: %d, last: %d\n", v[0], v[9]);
  12. return 0;
  13. }