C Program to Add Two Numbers using Pointers

Notes:

C Program to Add Two Numbers using Pointers:

Example Code:

#include <stdio.h>

int main()
{
int a = 10;
int b = 20;
int c = 0;

int* iptr1 = &a;
int* iptr2 = &b;
int* iptr3 = &c;

// value at iptr3 is pointing = value at iptr1 is pointing + value at iptr2 is pointing ;

*iptr3 = *iptr1 + *iptr2;

printf("Value at iptr3 is pointing = %d\n", *iptr3); // 30
printf("Value of c = %d\n",c); // 30

return 0;
}