Write a program to add 2 numbers using pointers.

/* Write a program to add 2 numbers using pointers.*/

#include <stdio.h>

void main()

{

    int a,b,c;

    int *p1,*p2,*p3;

    p1=&a;

    p2=&b;

    p3=&c;

    printf("Enter the value of A : ");

    scanf("%d",p1);

    printf("Enter the value of B : ");

    scanf("%d",p2);

    *p3=*p1+*p2;

    printf("The sum of %d and %d is %d\n",a,b,c);

    getch();

}

Comments

Popular posts from this blog

Write a program to accept numerator and denominator and find the remainder without using modulus (%) operator using do..while loop.