Saturday, June 20, 2020

Structure of Program in C

C program is a combination of one or more functions. C program contain one main function called main().Compiler start execution of program from main() function. Each C program contain following section such as:
  1. Preprocessor
    Programmer specify name of header file in this section. It provide instruction to C compiler.
    Header files such as: #include <conio.h> , #include<stdio.h> , #include<math.h> etc.
  2. Function Heading
    This section contain function name with arguments (if any) such as main().
  3. Variable Declaration
    This section contain variable declaration , definition , initialisation with their data type. Such as int x=1; , cahr a; , float p=3.14; etc. This section end with semi colon.
  4. Compound Statement
    This section contain group of statement. Statements contain printf , scanf , if..else , switch case , getch() , calculation (a=b+c) etc statements in this section. We can say that this section contain Input , Output , calculation part , condition statements.



No comments:

Post a Comment