In this tutorial, we are going to write a C Program to add two numbers using pointers in C Programming with practical program code and step-by-step full complete explanation.
C Program to add two numbers using pointers.
#include<stdio.h> #include<conio.h> void main() { int *p1, *p2, sum; clrscr(); printf("Enter two numbers: "); scanf("%d%d",&*p1,&*p2); sum=*p1+*p2; printf("sum=%d",sum); getch(); }
Output
Enter two numbers: 10 20 sum=30