Two similar programs both have errors on final line : <p>I have written two similar programs for my programming class.  I have shared the code for both programs due to them being similar in nature and both have compiler issues on the final line with     return0; For the first string of code the error I receive is "expected a declaration" and "syntax error: 'return'". For the second code I receive the errors "return value type does not match the function type" and " 'display': 'void' function returning a value.  I have deleted and added {} at different parts of both codes and tried to rearrange the code. Thanks for help in advance.</p>

<p>Code 1</p>

<pre><code>#include "stdafx.h"
#define nums 7

void display(int *);

int main()

{


    int channels[nums] = { 2,4,5,7,9,11,14 };
    printf("Channels: ");
    display(channels);
}

void display(int *channels)

{

    int i;
    for (i = 0; i &lt; nums; i++);

    {
        printf("%d", *(channels + i));
    }
}

return 0;  
</code></pre>

<p>code 2 </p>

<pre><code>#include "stdafx.h"
#define nums 7

void display(int *);


int main()
{

    int channels[nums] = { 2,4,5,7,9,11,13 };
    printf("channels: ");
    display(channels);
}

void display(int *channels)

{
    int i;
    for (i = 0; i &lt; nums; i++)
    {
        printf("%d", *channels);
        *channels++;
    }

    return 0;
}
</code></pre>
