Search



Saturday, 19 September 2015

Add two numbers using Pointers.

#include <stdio.h>
#include<conio.h>
void main()
{   clrscr();
int first, second, *ptr1, *ptr2,sum;
printf("Enter two integers to add\n");
scanf("%d%d", &first, &second);
ptr1 = &first;
ptr2 = &second;
sum = *ptr1 + *ptr2;
printf("Sum of entered numbers = %d\n",sum);
getch();
}


No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.