Page 1 of 1

Example A.37.1c

PostPosted: Wed Jan 30, 2008 3:19 am
by bda
Example A.37.1c makes no sense with respect to the usage of the two variables a and b. Either a comment should be added, that a and b only have values when used inside init(), or we need a different example, e.g.
Code: Select all
void init(int *a, int *b) {

    int r_a, r_b;

#pragma omp single copyprivate(x, y)
{
    scanf("%d %d %d %d", &r_a, &r_b, &x, &y);
} /* end of omp single */
   
    *a = r_a;
    *b = r_b;
}


The Fortran example is ok, since a and b can be assigned new values within init() and those values can be seen by the calling function.