Tuesday, January 24, 2012

Sample C Program To Add Two Numbers Using Pointers.

#include
#include
int main()
{

int x, y, *p, *q, sum;
printf(" Enter two integers to add " );
scanf(" %d %d ", &x, &y );

p = &x;
q = &y;
sum = *p + *q;

printf(" Sum of entered numbers = %d\n ", sum );
getch();
return 0;

}

No comments:

Post a Comment