skip to main |
skip to sidebar
Addition with Pointer
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,*pa,*pb,*pc;
clrscr();
pa=&a;
pb=&b;
pc=&c;
printf("Enter the value of a&b\n");
scanf("%d%d",pa,pb);
*pc=*pa+*pb;
printf("a=%d\n",*pa);
printf("b=%d\n",*pb);
printf("c=%d\n",*pc);
getch();
}
OUTPUT:
Enter the value of a&b
2
3
a=2
b=3
c=5

No comments:
Post a Comment