参考文章汪禅:http://www.cnblogs.com/lixiaohui-ambition/archive/2012/07/26/2610336.html
#include <omp.h>struct MyData
{
unsigned int value
unsigned int index
}
static struct MyData Test( unsigned int *p, unsigned int length)
{
#pragma omp parallel for
unsigned int i = 0, res = 0, j = 0
bool flag = false
struct MyData d = {0}
for( i = 0 i < length-1 i++ )
{
flag 芦脊= false
if( p[i] < p[i+1] )
{
res = p[i+1]
flag = true
}
if(flag)
{
j = 弊渣i+1
}
}
d.value 陪卜渗= res
d.index = j
return d
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)