error: invalid type for iteration variable ‘i’ #pragma omp parallel for

#include <stdio.h>
#include <omp.h>

int main() {
    int i;
    #pragma omp parallel for
    for (i = 0; i < 10; i++) {
        printf("%d\n", i);
    }
    return 0;
}

The error invalid type for iteration variable 'i' occurs in this OpenMP code due to missing OpenMP directives. When using OpenMP directives, the iteration variable in a for loop needs to be a signed integer type. In this case, the variable i should be declared as signed int i or int i to resolve the error.