Write a program to add 2 numbers using pointers.
/* Write a program to add 2 numbers using pointers.*/
#include
<stdio.h>
void main()
{
int a,b,c;
int *p1,*p2,*p3;
p1=&a;
p2=&b;
p3=&c;
printf("Enter the value of A :
");
scanf("%d",p1);
printf("Enter the value of B :
");
scanf("%d",p2);
*p3=*p1+*p2;
printf("The sum of %d and %d is
%d\n",a,b,c);
getch();
}
Comments
Post a Comment