getch() is the function which scans single key stroke.
so it'll be used to check output at the end of execution of program.
conio.h : Console input output
stdio.h : Standar input output
#include<stdio.h>
void main()
{
printf("Hello World...!!!");
getch();
}
//Simple variable declaration
#include<conio.h>
#include<stdio.h>
void main()
{
int a;
clrscr();// clear screen - clears previous screen out put
a=10;
printf("Value of a:%d",a);
getch();
}
so it'll be used to check output at the end of execution of program.
conio.h : Console input output
stdio.h : Standar input output
printf() is declared in stdio.h file while getch() is declared in conio.h file.
//Use of getch()
#include<conio.h>#include<stdio.h>
void main()
{
printf("Hello World...!!!");
getch();
}
//Simple variable declaration
#include<conio.h>
#include<stdio.h>
void main()
{
int a;
clrscr();// clear screen - clears previous screen out put
a=10;
printf("Value of a:%d",a);
getch();
}
output :
Value of a:10
//Multiple variable declaration
#include<conio.h>
#include<stdio.h>
void main()
{
int a,b;
clrscr();// clear screen - clears previous screen out put
a=10;
b=22;
printf("Value of a:%d",a);
printf("Value of b:%d",b);
printf("\n");//\n to print next statement in new line
printf("Value of a:%d and b:%d\n",a,b);
printf("Value of a:%d and b:%d\n",b,a);
getch();
}
#include<conio.h>
#include<stdio.h>
void main()
{
int a,b;
clrscr();// clear screen - clears previous screen out put
a=10;
b=22;
printf("Value of a:%d",a);
printf("Value of b:%d",b);
printf("\n");//\n to print next statement in new line
printf("Value of a:%d and b:%d\n",a,b);
printf("Value of a:%d and b:%d\n",b,a);
getch();
}
output :
Value of a:10Value of b:22
Value of a:10 and b:22
Value of a:22 and b:10
No comments:
Post a Comment