Holding program is important when it dircetly running its compiled binary
for example in windows compiled file are in .exe
format that means they are applications and can be launched by a click
At this contition conio.h
has the thing we require
we getch();
to hold output
This is a c code example to use pointers in swapping and adding two variable
- we use getch at last to hold the process
#include <stdio.h>
#include <conio.h>
int plus(int *a, int *b)
{
int sum=*a+*b;
return sum;
}
int __swaper(int *a, int *b)
{
int temp=*a;
*a=*b;
*b=temp;
}
int main()
{
int a,b;
char xit;
printf ("a = ");
scanf("%d", &a);
printf ("b = ");
scanf("%d",&b);
printf (" calcutating ..... \n ");
printf ("The Sum is %d \n", plus(&a,&b));
printf ("Swapped Values \n");
__swaper(&a,&b);
printf ("a = %d \n", a);
printf ("b= %d \n", b);
printf ("Press enter to exit ... \n");
getch();
return 0;
}