I try to work with OpenMP in C, but found some problem with the !=
operator and parallel for
.
For the next code:
#include <stdio.h>
int main ()
{
int array[] = {1,2,3,4,5, 6, 7};
int *p;
int *stop = array + 7;
#pragma omp parallel for
for (p = array; p != stop; p++)
printf("a: %d\n", *p);
return 0;
}
I get this error:
omp.c:10:18: error: invalid controlling predicate
for (p = array; p != stop; p++)
^
But when I replace the !=
with <
, it compiles and works great.
Is there any alternative? I want to paralleling a code with "stop" pointer, and have to use the !=
operator for that.
Compiling command: gcc -o omp.o -fopenmp example.c
Thanks!