C Program

First C Program

Social Shares
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

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.

Life Cycle Of C Program

 

  1. 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.
  2. 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.
  3. 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.
  4. 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

The General Structure of a general C program is being given below.
C Program Structure

Your first C program

#include <stdio.h>
int main()
{

    printf(“Hello Readers!”);

return 0;

}
The above C program generates the given output.
Hello Readers!

 

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*/

 

Let’s now try to understand the use of the comments with an example.
/* This is a c program which shows Hello World message on execution */
#include <stdio.h>
int main() /* Main function starts from here*/
{
   printf(“Hello World!”); /* This statement will print Hello World message */
   return 0;
}

 

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.

Hello World!

 

 


Social Shares
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

12 comments

  1. Hi,
    I’ve been following your blog.

    Your post is fantastic and resonated with me. I thought it was something my audience would appreciate, so I shared it with my social media.

    Thanks
    Ume Academy

Leave a Reply

Your email address will not be published. Required fields are marked *