Monday, January 4, 2010

Program to add two number using pointers.

#include
#include

void main()
{
int *p1,*p2,sum;
clrscr();
printf("enter two no's: ");
scanf("%d%d",&*p1,&*p2);
sum=*p1+*p2;
printf("sum=%d",sum);
getch();
}

 


Output:
enter two no’s: 10
20
sum=30

No comments:

Post a Comment