We have gained immeasurable theoretical data. currently its time to manoeuvre on and write our 1st program to print hello the world message and are aware of it.
it’s the terribly 1st program that the majority of the individuals write once begin learning any language.
Hello World program
This is a program to print “Hello World” message on the screen.
#include<stdio.h>
void main()
{
printf("Hello World");
}
Output
Hello World
Explanation
Now attempt to perceive this program step by step.
include: 1st statement started with #, it’s known as pre-processor directive. we’ll find out about them totally in later tutorials. #include is employed to incorporate the stdio.h header come in our program. Header files contains the functions that we tend to use in our program. Here we’ve got used printf() operate that is gift in stdio.h header file.
void main(): Here main() is that the operate. A program perpetually starts with the main() operate and each program should have main(). Here void is that the comeback form of this operates. It suggests that main() operate won’t come back something. The gap frizzy braces (and shutting curly braces (}) shows the body of the operate.
main() may also be known as as a group of statements.
- printf(): Here printf() is another operate. this can be wont to print the values on the screen. Its general type is
printf(“Statement you would like to print on-screen”);
- punctuation (;) is employed for denoting the termination of the statement. it’s conjointly known as statement exterminator in C Language.
How to compile and execute?
Here we tend to are exploitation Codeblocks IDE that comes with GCC compiler. If you have got not transferred it however then follow below link to understand a way to download and install it.