Developing First Program in C
Prerequisite
1. Editor
2. Compiler
3. Run-time environment (OS).
Editor + Compiler are availble as IDE (Integrated Development Environment). Such as Turbo C/C++, Dev C++,
codeblocks.
Ex:
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
printf("Welcome to C\n");
getch();
}
#include:
#include is a directive that calls the preprocessor to include the header file with our program.
Header file:
Header file contains the declaration of the predefined function.
<stdio.h> --> standard input output header file.
This header file contain standard input/output related predefine function.
Ex: printf(), scanf(), putc(), puts(), gets(), getc().... etc.
<conio.h> --> console input output header file.
This header file contains console screen related input/output related predefine.
Ex: clrscr(), clreol(), insline(), gotoxy(), getch(), getche(), cprintf(), cscanf().... etc.
main():-
main() is a function which is used to start the execution of our program. It is also called the entry point in our program.
void:-
void is a return type that returns nothing.
void main()
{ <-- starting of program
} <-- end of the program
clrscr():-
clrscr() is a predefined function in conio.h header file it is used to clear the output screen.
printf():-
printf() is a predefined function of stdio.h header file uses to print the content written inside the double quotation mark.
getch():-
It is a predefined function in conio.h header file uses to take a character from the user.
\n:-
It is used to add a new line character.
1. Editor
2. Compiler
3. Run-time environment (OS).
Editor + Compiler are availble as IDE (Integrated Development Environment). Such as Turbo C/C++, Dev C++,
codeblocks.
Ex:
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
printf("Welcome to C\n");
getch();
}
#include:
#include is a directive that calls the preprocessor to include the header file with our program.
Header file:
Header file contains the declaration of the predefined function.
<stdio.h> --> standard input output header file.
This header file contain standard input/output related predefine function.
Ex: printf(), scanf(), putc(), puts(), gets(), getc().... etc.
<conio.h> --> console input output header file.
This header file contains console screen related input/output related predefine.
Ex: clrscr(), clreol(), insline(), gotoxy(), getch(), getche(), cprintf(), cscanf().... etc.
main():-
main() is a function which is used to start the execution of our program. It is also called the entry point in our program.
void:-
void is a return type that returns nothing.
void main()
{ <-- starting of program
} <-- end of the program
clrscr():-
clrscr() is a predefined function in conio.h header file it is used to clear the output screen.
printf():-
printf() is a predefined function of stdio.h header file uses to print the content written inside the double quotation mark.
getch():-
It is a predefined function in conio.h header file uses to take a character from the user.
\n:-
It is used to add a new line character.
Comments
Post a Comment