First, we need to include the libraries to be used. Libraries contain the standard formats or collection of implementations that will be used.
For example, the library <stdio.h> contains the printf, scanf and other basic functions needed for the program to run.
Declaring libraries always start with a hashtag or sharp ( # )
#include<stdio.h>
Then, we write the main() function. The main() function contains all the blocks of codes of the program. For convenience of having the screen cleared every time a new program is run, we have the clrscr(); function. It can be written inside the main() function.
#include<stdio.h>
main()
{
}
Always remember to have the brackets to identify the scope of the main() function. When printing messages, characters, numbers and symbols, we use the printf(); function It is also used to print variables, functions and pointers. Always remember to put a semicolon ( ; ) after every function.
For printing or displaying the "Hello World!" message on the screen we write:
printf("Hello World!");
For printing or displaying the "Hello World!" message on the screen we write:
printf("Hello World!");
No comments:
Post a Comment