program that determines if array is ascending, descending, or random(C language) : <p>i have to build a program that scans "size", then array in the size of "size".
returns 1 if ascending, -1 if descending, and 0 if neither.</p>

<p>so for I've came up with this, and its not working.</p>

<pre><code>int UpOrDown(int *arr,int size)
{
int i,j,flag;
if(arr[0]&lt;arr[1])// ascending or random
{
    flag=1;
    {
        for(i=1;i&lt;size;i++)
            if(arr[i]&gt;arr[i+1])
                flag=0;
    }
    if (flag=0) return 0;
    else return 1;
}
else //descending or random
{
    flag=-1;
        if(arr[0]&gt;arr[1])  
        {
            for(i=1;i&lt;size;i++)
                if(arr[i]&lt;arr[i+1])
                    flag=0;
        }
        if (flag=0) return 0;
        else return -1;
}
</code></pre>

<p>i'd appreciate some guidance.</p>
