Skip to main content

HELLO WORLD IN C PROGRAM

HELLO WORLD IN C PROGRAM Skip to main content

HELLO WORLD IN C PROGRAM

       C Program  Syntax/Structure


Basic C program:-


Explanation

  1. 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.
  2. The next line int main() is the main function where the program execution begins.
  3. The next line printf(...) is another function available in C which causes the message "Hello, World!" to be displayed on the screen.
  4. 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:

  1. The Documentation Section: Consists of a set of comment lines giving the name of the program and other details.

  2. The Link Section: Provides instructions to the compiler to link functions from the system library.

  3. The Definition Section: Defines all symbolic constants.

  4. The Global Declaration Section: There are some variables and those variables are declared in this section that is outside of all functions.

  5. 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.

  6. Declaration Part declares all the variables used in the executable part.

  7. The Subprogram Section contains all the user defined functions that are called in the main function.                                                                                                                                                                                             Posted by Sampath Raja

Comments

Popular Posts

HELLO WORLD IN C PROGRAM Skip to main content

C Program Syntax/Structure

       C Program  Syntax/Structure


Basic C program:-


Explanation

  1. 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.
  2. The next line int main() is the main function where the program execution begins.
  3. The next line printf(...) is another function available in C which causes the message "Hello, World!" to be displayed on the screen.
  4. 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:

  1. The Documentation Section: Consists of a set of comment lines giving the name of the program and other details.

  2. The Link Section: Provides instructions to the compiler to link functions from the system library.

  3. The Definition Section: Defines all symbolic constants.

  4. The Global Declaration Section: There are some variables and those variables are declared in this section that is outside of all functions.

  5. 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.

  6. Declaration Part declares all the variables used in the executable part.

  7. The Subprogram Section contains all the user defined functions that are called in the main function.                                                                                                                                                                                             Posted by Sampath Raja

Comments

Popular Posts

Comments

Popular Posts