#include <stdio.h>
int main() {
printf("Hello World!");
return 0;
}
The first thing we do is add libraries to the program. These libraries contain functions or methods that work for us. You don't need to know what is going on behind the scenes, you are just requesting the action you want using the functions or methods inside these libraries and classes.
To join any library, you only need to write the following line of code.
#include <yourlibrary.h>
You can add as many libraries as you want at the beginning of the code, one after the other, with this command.
#include <yourlibrary1.h>
#include <yourlibrary2.h>
#include <yourlibrary3.h>
#include <yourlibrary4.h>
Here, because we want to display a message to the user on the screen, our function is printf() which is in the library stdio.h . So we have to paste this library at the beginning of the code first.
In this case, the compiler will refer to this library and the definition of this function of the program will be pasted, otherwise, in the absence of this library, an error will be issued and your program will not run.
In C language, we have a function called main() that is your main function. All your programs should be written in this function.
When the compiler sees this function, it executes everything inside it, and its absence means that your program will not run.
Rules:
return 0 ends the main() function.