A.10 Specifying Sequential Ordering
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
Ordered sections (Section 2.6.6 on page 22) are useful for sequentially ordering the output from work that is done in parallel. The following program prints out the indexes in sequential order:
#pragma omp for ordered schedule(dynamic)
for (i=lb; i<ub; i+=st)
work(i);
void work(int k)
{
#pragma omp ordered
printf_s(" %d", k);
}