In this program, you will accept three numbers from the user and find the largest number using a pointer.
#include<stdio.h>
int main()
{
int *p1,*p2,*p3,a,b,c;
p1=&a;
p2=&b;
p3=&c;
printf("\n enter three number:");
scanf("%d%d%d",p1,p2,p3);
if(*p1>*p2)
if(*p1>*p3)
printf("maximum is %d",*p1);
else
printf("maximum is %d",*p3);
else
{
if(*p2>*p3)
printf("maximum is %d",*p2);
else
printf("maximum is %d",*p3);
}
return 0;
}
enter three number:7 9 3 maximum is 9