Addition with Pointer

Thursday, 8 September 2011

#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

 

Blogger news

Blogroll

Enter your email address:

Delivered by FeedBurner

Total Pageviews

Followers

Most Reading