Page 7 - PROGRAMMING IN C_Neat
P. 7

 Example:
           Program to add two numbers.
                                                                     Include Section
                             #include  <stdio.h>
                              main()
                             {                                       main() Section

                                        int   a, b, sum;             Local Declaration Section


                                        scanf(“%d %d”, &a, &b);      Statement Section
                                        sum = a + b;
                                        printf(“Sum = %d”, sum);
                             }
        _______________________________________________________________________________________

        7. Explain the steps involved in executing a C program. *

        Execution of C Program:
        1. Creating the Program:
           The program should be typed in the Turbo C editor and saved.
           This program is called source program.
           Source Program – General Form:

                                                filename.c
           Example: Sample.c

        2. Compiling the Program:
           Compilation is the process of converting the source program into machine language program (object
            program).
           The source program should be compiled using the Compile option in the Turbo C editor.
           During compilation, source program is converted into object program.
           Object Program - General Form:

                                                filename.obj
           Example: Sample.obj

        3. Linking and Running the Program:
           Linking is the process of connecting header files with the program.
           Linking converts object program into executable program.
           Executable Program – General Form:

                                                filename.exe
           Example: Sample.exe

           Executable program should be run using the Run option in the Turbo C editor.
   2   3   4   5   6   7   8   9   10   11   12