I am building a Visual Studio C++ function for a school project. It is giving me error codes LNK1120 and LNK2019, my program is:
#include "stdafx.h"
#define m 40
int max_zero_len(int arr[], int x, int* max_len);
void _main()
{
    int arr[m];
    int i, x=40, place,Mlen=0;
    srand((unsigned int)time(NULL));
    for (i = 0; i < m; i++)
    {
        arr[i] = rand() % 3;
        printf("%d ", arr[i]);
    }
    place = max_zero_len(arr, x,&Mlen);
    if (Mlen)
    printf("the max zero is:%d and the position is:%d\n", Mlen,place);
    else printf("an array does not sequence of zero\n");
}
int max_zero_len(int arr[], int x, int* max_len)
{
    int zcounter = 0, j,place=0;
    for (j= 0; j< m; j++)
    {
        if (!arr[j])
            zcounter++;
        else
        {
            if (zcounter > *max_len)
            {
                *max_len = zcounter;
                place = j - zcounter + 1;       //position of sequence
            }
            zcounter = 0;
        }
    }
    return place;
}
The errors are:
Error   1   error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup   E:\c++\lab8\tar3\tar3\MSVCRTD.lib(crtexe.obj)   tar3
Error   2   error LNK1120: 1 unresolved externals   E:\c++\lab8\tar3\Debug\tar3.exe 1   1   tar3
When I debug there are no errors. The errors only occur when I run the program. How can I fix the errors?
 
     
    