Before we start the basic building blocks of the C programming language, we must know the Program Structure of C for the building of programs.
A C program basically consists of the following parts:
- Preprocessor Commands.
- Statement & Expressions.
Let see the basic structure below to print Hello World:
/* This is my First Program */
// First Program
printf("Hello, World! \n");
Now, let’s know the various parts of the above example:
#include <stdio.h>is a preprocessor command, the first line of the program that adds the stdio.h file before the program compilations.
- Next is
int main()which is the main function where the program execution begins.
//is a comment box that will not be executed by the compiler.
printf(...)is a function in C that displays the message “
Hello, World!” on the screen. The message needs to be under
return 0;in a program terminates the
main()function and returns the value 0.