Program to add two numbers using pointers in c; Through this tutorial, we will learn how to add two numbers using pointers in c program.
C Program to Add Two Numbers using Pointers
/* Sample C Program to Add Two Numbers using Pointers */ #include <stdio.h> int main() { int number1, number2, sum; int *pntr1, *pntr2; pntr1 = &number1; pntr2 = &number2; printf(" Please Enter two integer values : \n "); scanf("%d %d", pntr1, pntr2); sum = *pntr1 + *pntr2; printf(" The Sum of two integer values is = %d", sum); return 0; }
The output of the above c program; is as follows:
Please Enter two integer values : 10 20 The Sum of two integer values is = 30