C program life cycle
C program can have 4 steps to create any program. These steps are in a certain order and each of these steps has its own importance. Let’s try to understand this process before creating the first C program.
- First, you write a C program. This is called the editing part of the program development life cycle. This program is in human-readable format.
- After this, you compile the C program. This is the second step of development life cycle. By removing all the errors in this part, the program is converted into a binary format so that the computer can process it.
- After that comes the linking process. In this process, the program is linked with the necessary libraries. As you know, the basic program of C cannot be executed without including the libraries. Libraries Provide Environment Program to Program Executes.
- After this executable file is processed. Which you can execute as often as you want. The output process of the editing process is a .c source file. The input source of the compiling process is the .c file and the output is .obj file. The linking process has an input .obj file and output is a .exe file.
Structure of the C program
Your first C program
In the first line, the <stdio.h> a header file is included in the program. This is a standard input/output header file which handles input and output in the program.
They are also called pre-processor directives. Detailed information about these can be obtained by reading the relevant tutorials.
After this, the main () function has been started. Main Function starts the execution of the program itself. All Instructions are written in this function. Man Function is played by the start and end curly brackets. All the instructions within these curly brackets are executed.
Man Function is defined with int type. This is a standard. Man function always has to return an integer value. If you do not return a value from the main () function in the program, then at the end of the program, the return statement writes statements.
Commenting in C program
A comment in your program contains text that ignores the compiler. This text is not executed like the rest of the statements. The comments program is used to define a statement or programmatically.
The general form of commenting in C language is given below.
/* Here your comment text will be written*/
/* This is a c program which shows Hello World message on execution */
int main() /* Main function starts from here*/
printf(“Hello World!”); /* This statement will print Hello World message */
As you can see in the program given above, an explanation has been given about programs and other statements through the Commands. This program generates the given output.