Why does my C program not run? : <pre><code>#include &lt;stdio.h&gt;
#include &lt;math.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;time.h&gt;

#define N 7

void getArray1(int ar1[])
{
    int i;
    printf("Enter %d integers:", N);
    for (i = 0; i &lt; N; i++)
    {
        scanf("%d", &amp;ar1[i]);
    }
}

void getMax(int *p)
{
    printf("Enter a max value greater than zero:");
    scanf("%d", *p);
        while (*p = 0 || *p &lt; 0)
        {
            printf("Incorrect input, try again:");
            scanf("%d", *p);
        }
}


void fillRandom (int ar2[], int max)
{
    int i;
    for (i = 0; i &lt; N; i++)
    {
        ar2[i] = rand() % (max+1);
    }
}

void checkMatching(int ar1[], int ar2[], int ar3[])
{
    int i, j=0, flag = 1;
    for (i = 0; j &lt; N; j++)
    {
        while (flag!=0)
        {
            if (ar1[i] == ar2[j])
                flag = 0;   
            j++;
            if (flag == 0)
                j = 0;
        }
        if (flag == 1)
            ar3[i] = ar1[i];
        flag = 1;
    }
}

void printMatching(int ar3[])
{
    int i, flag = 0;

    for (i = 0; i &lt; N; i++)
    {
        if (ar3[i] != 0)
        {
            printf("%d", ar3[i]);
            flag = 1;
        }
    }
    if (flag == 0)
        printf("All numbers from ar1 appear in ar2!");
}

void main()
{
    int maxValue;
    int ar1[N];
    int ar2[N];
    int ar3[N] = { 0 };
    srand(time(NULL));

    getArray1(ar1[N]);
    getMax(&amp;maxValue);
    fillRandom(ar2[N], maxValue);
    checkMatching(ar1[N], ar2[N], ar3[N]);
    printMatching(ar3[N]);
}
</code></pre>

<p>I'm very new to programming and this is an assignment I have. Basically, the program is supposed to get one array from the user, fill a second array with random numbers from 0 to a value selected by the user, and then print the elements in the first array that do not appear in the second. </p>

<p>I'm using Visual Studio, the program compiles ok, no errors are shown, but after typing 7 numbers it crashes (ConsoleApplication has stopped working) and I just can't figure out why.</p>
