C Programming
Computer Programming

Program in C to addition of two number using pointer



Write a Program in C to addition of two number using pointer

\* C Program to to addition of two number using pointer *\

# include < stdio.h >
int   main( )
{

int   a, b, sum  ;
int   *p1, *p2, *ps  ;
printf(" Enter the first number : ") ;
scanf("%d ", & a) ;
printf("\n Enter the second number : ") ;
scanf("%d ", & b) ;
p1 = &a  ;
p2 = &b  ;
ps = &sum  ;

sum = *p1 + *p2  ;
printf("\n Sum of two number is :%u ", *ps) ;
return ( 0 );

}

Output of Program :

Output of Program in C to addition of two number using pointer