HELLO WORLD IN C PROGRAM
- Get link
- Other Apps
Labels
HELLO WORLD IN C PROGRAM
C Program Syntax/Structure
Basic C program:-
Explanation
- The first line of the program #include <stdio.h> is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation.
- The next line int main() is the main function where the program execution begins.
- The next line printf(...) is another function available in C which causes the message "Hello, World!" to be displayed on the screen.
- The next line return 0; terminates the main()function and returns the value 0.
Complete Structure of C Program:-
Above C program is Divide into following Parts:
- The Documentation Section: Consists of a set of comment lines giving the name of the program and other details.
- The Link Section: Provides instructions to the compiler to link functions from the system library.
- The Definition Section: Defines all symbolic constants.
- The Global Declaration Section: There are some variables and those variables are declared in this section that is outside of all functions.
- main( ) function: Every C program must have one main function section. This section contains two parts, declaration and executable part.
There should be at least one statement in the executable part which contains instructions to perform certain task.
The declaration and executable part must appear between the opening and closing braces. All statements in the declaration part should end with the semicolon. - Declaration Part declares all the variables used in the executable part.
- The Subprogram Section contains all the user defined functions that are called in the main function. Posted by Sampath Raja
Popular Posts
INTRODUCTION TO PROGRAMMING LANGUAGES or WHAT ARE PROGRAMMING LANGUAGES
- Get link
- Other Apps
- Get link
- Other Apps
Labels
C Program Syntax/Structure
C Program Syntax/Structure
Basic C program:-
Explanation
- The first line of the program #include <stdio.h> is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation.
- The next line int main() is the main function where the program execution begins.
- The next line printf(...) is another function available in C which causes the message "Hello, World!" to be displayed on the screen.
- The next line return 0; terminates the main()function and returns the value 0.
Complete Structure of C Program:-
Above C program is Divide into following Parts:
- The Documentation Section: Consists of a set of comment lines giving the name of the program and other details.
- The Link Section: Provides instructions to the compiler to link functions from the system library.
- The Definition Section: Defines all symbolic constants.
- The Global Declaration Section: There are some variables and those variables are declared in this section that is outside of all functions.
- main( ) function: Every C program must have one main function section. This section contains two parts, declaration and executable part.
There should be at least one statement in the executable part which contains instructions to perform certain task.
The declaration and executable part must appear between the opening and closing braces. All statements in the declaration part should end with the semicolon. - Declaration Part declares all the variables used in the executable part.
- The Subprogram Section contains all the user defined functions that are called in the main function. Posted by Sampath Raja
Comments
Popular Posts
INTRODUCTION TO PROGRAMMING LANGUAGES or WHAT ARE PROGRAMMING LANGUAGES
- Get link
- Other Apps
Comments
Post a Comment