C Program to Find Largest of Two Numbers using Pointers
#include<stdio.h> #include<conio.h> void main() { int x,y, *large, *xptr,*yptr; clrscr(); printf("Enter the value of x and y :"); scanf("%d%d",&x,&y); xptr=&x; yptr=&y; if(*xptr>*yptr) large=xptr; else large=yptr; printf("The largest nmuber is : %d",*large); getch(); }
Output:
Enter the value of x and y: 25 24
The largest number is : 25