C Program to Add Two Numbers using Pointers

C Program to Add Two Numbers using Pointers

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

Recommended C Programs

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *