Sunday 6 January 2019

Filled Under:

Addition using pointer in c[c programming examples with output]

C programming examples with output

Addition using pointer
Program

#include<stdio.h>
int 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);
      return 0;
}

Output:
Enter two integers to add
4
6
Sum of entered numbers=10

0 komentar:

Post a Comment