Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* sum of two variables using pointers */
- #include<conio.h>
- #include<stdio.h>
- int main()
- {
- int a,b,*ptr1,*ptr2,sum=0;
- clrscr();
- ptr1=&a;
- ptr2=&b;
- printf("Enter values of a and b:\n");
- scanf("%d%d",&a,&b);
- sum=*ptr1 + *ptr2;
- printf("Sum of a & b is %d",sum);
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment