General structure of the program
The program must contain the main() function from which its execution begins.
You can create subroutines. Declare variables.
Variables can be global and local.
The general structure of the program is shown below
int my_global_var1 = 1; // declaring an integer variable and assigning it an initial value.
double my_global_var2; // declaration of a real type variable
Example of the program.
int main()
{
int my_local_var = 2; // declare integer variable
my_local_var = my_func(); // calling function my_func() with set result to variable
}
// declare own function, returning integer
int my_func()
{
int my_local_var = 3; // declare integer variable inside the function
return 10; // value, that function will return
}