Custom Search

Saturday 21 January 2012

Write a c program to add 2 numbers using pointers

Author: Sanif S S 
Site: theeduzone.blogspot.com 
Email: sanifss@gmail.com

#include<stdio.h>
#include<conio.h>
void 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);
 
   getch()
}

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...