error: ‘::main’ must return ‘int’

#include <iostream>

using namespace std;

int i=1;
void main()
{
    int i=i;
}

Error running:

error: '::main' must return 'int'

Reason: The C standard allows the main function to be of type void. In C++, main must be of type int.

Read More: