Hello,
I need your help, Ive got a function and I consider it as a sort function but I am not sure about the type of sort and the complexity.
Moreover I cannot quite get what does exactly the "||" mean in the specific point of that function.
Thank you for any help
void teest(int *prm1, int prm2)
{
int m, n, x, y, z, tmp, flg;
for(m=prm2-1; m>0; --m)
{
flg = 0;
x = y = n = 0;
z = 1;
for (; n<m; x++, z++)
{
if (*(int*)(prm1+n) > *(int*)(prm1+z))
{
x = y + *prm1 - *(prm1+n+1);
tmp = *(prm1+n);
*(prm1+n) = *(prm1+n+1);
y = x?++x:x-2;
*(prm1+n+1) = tmp;
flg=1;
if (x > y)
y = tmp+x || tmp == ++x;
}
++n;
}
if (!flg)
break;
}
}
*(int*)(prm1+n) can be written as prm1[n] (the cast is unnecessary) *prm1 can be written as prm1[0] and similarly, *(prm1+n+1) can be written as prm1[n + 1]