Program 1: Programming exercise on creating and executing a C program.
To create and execute C programs in the Windows Operating System, we need to install Turbo C
software. We use the following steps to create and execute C programs in Windows OS.
Step 1: Creating a Source Code
Source code is a file with C programming instructions in a high-level language. To create source
code, we use any text editor to write the program instructions. The instructions written in the
source code must follow the C programming language rules. The following steps are used to
create a source code file in Windows OS…
Click on File -> New in C Editor window
Type the program
Save it as FileName.c (Use shortcut key F2 to save)
Step 2: Compile Source Code (Alt + F9)
Whenever we press Alt + F9, the source file is going to be submitted to the Compiler. On
receiving a source file, the compiler first checks for the Errors. If there are any Errors then
compiler returns List of Errors, if there are no errors then the source code is converted
into object code and stores it as a file with .obj extension. Then the object code is given to
the Linker. The Linker combines both the object code and specified header file code and
generates an Executable file with a .exe extension.
Step 3: Executing / Running Executable File (Ctrl + F9)
We use a shortcut key Ctrl + F9 to run a C program. Whenever we press Ctrl + F9, the .exe file
is submitted to the CPU. On receiving .exe file, CPU performs the task according to the
instruction written in the file. The result generated from the execution is placed in a window
called User Screen.