This leaves us with something like this:
int main()
{
return 0; // Just return 0
}
Where:
- int: is the type of the data returned (an integer, returned by return),
- main: is the name of the function being defined and
- the parenthesis ( ): indicate that "main" is a function and the parameter list is empty.
- braces { }: contain the function code executed when called the function
- double slash //: tells to ignore the text placed at the right of them
So the only thing that this program does is to return 0 to the operating system or program which executed it.
Now let's make something more interesting because this program is too small and does nothing. We're gonna be adding some text to be displayed by the program. This makes our code to transform into this:
#include <stdio.h> // this line tells the program to include all the text found in stdio.h as part of our program, so we have access to more functions that come with the compiler
int main()
{
printf("Hello World!\n"); // print some text using a function taken from <stdio.h>
return 0;
}
You can now press F5 and see the output window of the program pop-up:
After this, we're going to be building a small realtime execution flow in order to start with a proper game project. See you there :)

No hay comentarios:
Publicar un comentario