In this program, you will learn to find product of numbers using pointers. The pointer is a variable which stores the address of another variable. This variable can be of type int, char, array, function, or any other pointer. The size of the pointer depends on the architecture. However, in 32-bit architecture the size of a pointer is 2 byte.
#include<stdio.h>
#include<conio.h>
void main()
{
int *p1,*p2, n1, n2, mul;
clrscr();
printf("Enter first no. : ");
scanf("%d",&n1);
printf("Enter second no. : ");
scanf("%d",&n2);
p1 = &n1;
p2 = &n2;
mul=(*p1) * (*p2);
printf("\nMultiplication is %d", mul);
getch();
}
Enter first no. : 12
Enter second no. : 6
Multiplication is 72