AbdulFathaah

sum of 2 variables using pointers

Nov 13th, 2023
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. /* sum of two variables using pointers */
  2.  
  3. #include<conio.h>
  4. #include<stdio.h>
  5. int main()
  6. {
  7. int a,b,*ptr1,*ptr2,sum=0;
  8. clrscr();
  9. ptr1=&a;
  10. ptr2=&b;
  11. printf("Enter values of a and b:\n");
  12. scanf("%d%d",&a,&b);
  13. sum=*ptr1 + *ptr2;
  14. printf("Sum of a & b is %d",sum);
  15. getch();
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment