Step4:
Write the total C program within the structure of a C
program (main function).
1. It is to include a header file called stdio.h, which
allows to use input and output functions like printf, scanf etc (Covered
later).
2. It is the function from where program execution starts.
3. Start of main() function (Functions are covered later).
4. Declaration section, where all the variables used in a
program are declared.
5. Assigning, input and output statements.
6. End of main function.
Example:
#include<stdio.h>
void main()
{
int x,y,z;
x=45;
y=25;
z=x+y;
printf(“sum of %d and %d is %d”,x,y,z);
}
Output:
Sum of 45 and 25 is 70
Step5:
Executing the program using any C compiler
It changes according to the platform and compiler.
Installation and execution procedure “Turbo C” is explained
here.
Installation of turboc2 (for Windows and DOS)
1. Copy the “turboc2” folder to the required place (c:\)
2. Create short-cut for tc.exe which is in c:\turboc2\
Open the “turboc2” folder
Right click on “tc”
Select “send to” from pop-up menu
Select “Desk top” to create short-cut on desk top
3. Configuring “turboc2”
Double click on “short cut to tc” which on the desk top to
open C-IDE
Select Options (Alt+ O) – Directories (D ) [O is the hot key
of Options, D is the hot key of Directories].
Set the “include” directory to the “c:\turboc2\indlude”
Set the “lib “ directory to the “c:\turboc2\lib”
Set the “turboc2” directory to the “c:\turboc2”
Save the options on to “c:\turboc2\tcconfig.tc” by selecting
Options (Alt+O) – Save (S)
0 comments:
Post a Comment