b. Structure of C programming

Anatomy of a C Program

C language has a bundle of protocols that define its programming activities.

The C programming language came into existence when its developers were working on the development of the Unix operating system using the B language, out of which C evolved. The B language lacked certain features that led to the introduction of C. These features constituted the part of the C program upon which it was is built.

Parts of C program-

# include <stdio.h> – This command is a preprocessor directive in C that includes all standard input-output files before compiling any C program so as to make use of all those functions in our C program.

 int main() – This is the line from where the execution of the program starts. The main() function starts the execution of any C program.

{ (Opening bracket) – This indicates the beginning of any function in the program (Here it indicates the beginning of the main function).

/* some comments */ – Whatever is inside /*——-*/ are not compiled and executed; they are only written for user understanding or for making the program interactive by inserting a comment line. These are known as multiline comments. Single line comments are represented with the help of 2 forward slashes “//——”.

printf(“Hello World”) –The printf() command is included in the C stdio.h library, which helps to display the message on the output screen.

getch() – This command helps to hold the screen.

return 0 –This command terminates the C program and returns a null value, that is, 0.

} (Closing brackets)-  This indicates the end of the function. (Here it indicates the end of the main function)

Before we move towards an example, you should revise the Syntax of C.

Leave a Reply

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