Program to add two numbers using pointers in C

#include <stdio.h>

int main()
{
   int first, second, *p, *q, sum;

   printf("Enter two integers to addn");
   scanf("%d%d", &first, &second);

   p = &first;
   q = &second;

   sum = *p + *q;

   printf("Sum of entered numbers = %dn",sum);

   return 0;
}

Output
Enter two integers to add
5
3
Sum of entered numbers =8

Discover more from PlusDigit

Subscribe to get the latest posts sent to your email.

Discover more from PlusDigit

Subscribe now to keep reading and get access to the full archive.

Continue reading

AdBlock Detected!

Please disable your AdBlocker to access this website.

Once disabled, this message will disappear automatically.