The first program in c is printing the hello world to the output screen (Hello World Program in C).
Hello world program in c is the most simple and basic program to print hello world in c.
For printing the hello world we should clear of the following c topic :
C Input and output
If you know the basic input and output concept it’s enough to write the hello world program in c.
Now let’s see the algorithm and program for hello world program in c.
hello world in c
- Include standard input and output directories.
- Print hello world using standard output function.
- Return from the function.
Hello world program in c
//print hello world to screen
1. In starting the program first we start with including the standard libraries (preprocessor commands). This command tells the compiler to include the stdio.h header file. The compiler includes the functions in stdio.h header file in the program. The stdio.h contains input and output functions such as printf() and scanf(). Using the printf() in the program without standard library file will give the compile time error.
2. Now we write the main() function, the execution of the program starts with the main().
3. Next, we write printf() , the printf() is a library function in standard io which is used to send the formatted stream(data) to the output screen. So using printf we print hello world.
In this program, the compiler reads the line printf (“hello world”); and writes a string in double quotes to the screen.
4. At the ends as main returns anything (as we written int as a return type of main), we return 0 (successful execution termination ) and return from the program.
5. Now we will see hello world printed to the output screen.