6. Simple program in C
// file name hello.c
#include<stdio.h>
void main( )
{
printf(“Hello World”);
}
This program in Linux following commands are
used
1)Create: gedit hello.c
2) Compile: gcc hello.c
3) Run: ./a.out
7. On Window Turbo C++ IDE
- To create a new file press File -> New, on menu
bar
- Write down complete program
- To save press F2 or File -> save, on menu bar
- To compile Compile -> compile on menu bar or
ALT+F9 key
If error found then again correct error and need
to compile the same. If no error then, we can
execute program.
- To run Run -> run on menu bar, or CTRL + F9
11. Structure of C Program
Document Section /*Title of the program*/
/*Addition of two no.s*/
Link Section (Header files/
Preprocessor Statements)
#include<stdio.h>
Definition section #define PI 3.142
Global Declaration section int a=20;
main () function section
{
Declaration part;
Execution part;
}
void main(){
int b=10, sum; sum=a+b;
printf(“Sum=%d”,sum);
}
Subprogram section
(user defined function)
Function 1
Function 2
Function n