C Program to add two number using pointers.

/*   Write a C Program to add two number using pointers.  */
============================================
#include<stdio.h>
#include<conio.h>
void main()
{
int *p1,*p2,sum;
clrscr();
printf(“enter two no’s: ”);
scanf(“%d%d”,&*p1,&*p2);
sum=*p1+*p2;
I
CP
29
NTRODUCTION
ROGRAMS
printf(“sum=%d”,sum);
getch();
}

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

No comments: