Monday 2 December 2013

C program to add two numbers using pointers

C programming code

#include <stdio.h>
 
int main()
{
   int first, second, *p, *q, sum;
 
   printf("Enter two integers to add\n");
   scanf("%d%d", &first, &second);
 
   p = &first;
   q = &second;
 
   sum = *p + *q;
 
   printf("Sum of entered numbers = %d\n",sum);
 
   return 0;
}
Download Add integers using pointers program.
Output of program:
add numbers using pointers

No comments:

Post a Comment