You have two problems:
main not a loop. This is a function.
Your function syntax is incorrect. After the function name, you must have parentheses. Any of these are valid syntax for main :
int main() { } int main(int argv, const char* argv[]) { }
Then you can declare a local variable inside main as follows:
int main() { int local_variable = 0; }
or assign a global variable as follows:
int global_variable; int main() { global_variable = 0; }
source share