Monday, 13 July 2015

Write C Program to Perform Addition of Two Numbers Using Pointers

1:  #include <stdio.h>  
2:  int main()  
3:  {  
4:    int first, second, *p, *q, sum;  
5:    printf("Enter two integers to add\n");  
6:    scanf("%d%d", &first, &second);  
7:    p = &first;  
8:    q = &second;  
9:    sum = *p + *q;  
10:    printf("Sum of entered numbers = %d\n",sum);  
11:    return 0;  
12:  }  

No comments:

Post a Comment