exception error in program
<pre><code>int maxNum(int *n)
{
    int Maximum = n[0];

    for(int i = 1; i &lt;= 8; i++)
    {
        if( Maximum &lt; n[i] )
            Maximum = abs(n[i]);
    }

    return Maximum;
}

void DibHomoginityDetect(CDib&amp; dib)
{
    register int i,j,x[8];

    int w = dib.GetWidth();
    int h= dib.GetHeight();

    CDib cpy =dib;
    BYTE** ptr1 = dib.GetPtr();
    BYTE** ptr2 = cpy.GetPtr();

    for(j = 1;j&lt;h-1;j++)
    {
        for(i=1;i&lt;w-1;i++)
        {
            x[1]= (ptr2[j][i]-ptr2[j-1][i-1]);
            x[2] =(ptr2[j][i]-ptr2[j-1][i]);
            x[3] =(ptr2[j][i]-ptr2[j-1][i+1]);
            x[4] =(ptr2[j][i]-ptr2[j][i-1]);
            x[5] =(ptr2[j][i]-ptr2[j][i+1]);
            x[6] =(ptr2[j][i]-ptr2[j+1][i-1]);
            x[7] =(ptr2[j][i]-ptr2[j+1][i]);
            x[8] =ptr2[j][i]-ptr2[j+1][i+1];

            //assign the central pixel of window to image central pixel
            ptr1[j][i] = (BYTE)maxNum(x);
        }
    }
}
</code></pre>

<p>what is wrong with this program.. as i understand it should work but i am getting exception error ...</p>

<p>Anyone can hellp  me that where did i make mistake .. .. thanks</p>
