You have two problems:
main
is not a loop. It's a function.Your function syntax is wrong. You need to have parentheses after the function name. Either of these are valid syntaxes for
main
:int main() { } int main(int argc, const char* argv[]) { }
Then, you can declare a local variable inside main
like so:
int main() {
int local_variable = 0;
}
or assign to a global variable like so:
int global_variable;
int main() {
global_variable = 0;
}