Disqus Shortname

Sunday, August 16, 2015

Program: Add Two Numbers using Pointers



#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;
}

/*-via Programming Hub for Android, a top rated Programming App on Google Play

https://play.google.com/store/apps/details?id=com.freeit.java*/


No comments:

Post a Comment