Structure Of Any C Program:-
Before we study the basic building blocks of the C programming language, let uslook at a bare minimum C program structure so that we can take it as a
reference in the upcoming chapters.
A C program basically consists of the following parts:
1. Preprocessor Commands
2.Functions
3.Variables
4. Statements & Expressions
5. Comments
Let us look at a simple code that would print the words "Hello World":
Example Program:-

Explanation of structure of program using Above Program:-
1.)The first line of the program #include <stdio.h> is a preprocessorcommand, which tells a C compiler to include stdio.h file before going to
actual compilation.
2.)The next line int main() is the main function where the program execution
begins.
3.)The next line /*...*/ will be ignored by the compiler and it has been put to
add additional comments in the program. So such lines are called
comments in the program.
4.)The next line printf(...) is another function available in C which causes the
message "Hello, World!" to be displayed on the screen.
5.)The next line return 0; terminates the main() function and returns the
value 0.
How To Compile And Run Above Program
1.Windows User:-
install turbo c,or dev compiler and type this program to compiler
and save it any name.c after that compile it by ALT+F9 and
then run by CTRL+F9..
OUTPUT OF THIS PROGRAM:-
Hello,World!That's all about Structure Of Any C
programs...
I hope You Will Like It:
Please Share This On Sociel Media
Comments
Post a Comment