Thursday 3 October 2013

Addition using pointers in C

#include<stdio.h>
main()
{
int num1,num2,*p,*q,sum;
printf("\n(There is) none worthy of worship except Allah(Subhanahu wa ta'ala).Muhammad(Sallallahu alayhi wasallam) is Messenger of ALLAH(Subhanahu wa ta'ala).\n");
printf("\n::Enter the numbers:: ");
scanf("%d%d",&num1,&num2);
p=&num1;
q=&num2;
sum=*p+*q;
printf("\n::Sum of the numbers using pointers is::%d\n",sum);
}

No comments:

Post a Comment