C Program - Addition using pointers

#include <stdio.h>
#include <conio.h>

int main()
{
    int first, second, *p, *q, sum;

    printf("Enter two integers to add\n");
    scanf("%d%d", &first, &second);

    p = &first;
    /*storing address of first in p*/
    q = &second;
    /*storing address of second in q*/

    sum = *p + *q;
    /*adding contents of address stored in p & q*/

    printf("Sum of entered numbers = %d\n",sum);
    getch();

    return 0;
}

Output
-------------


Comments

Popular posts from this blog

Introduction to C++ Programming Language

The Assembly Process Of 8086 Microprocessor-Two Pass Assembling Steps

Installing 8086 Assembler on a Computer