#include "stdio.h"
#include "conio.h"
int *larger(int *,int *);
void main()
{
int a,b;
int *p; /* Pointer to Integer */
clrscr();
printf("Input 2 Numbers:\n");
scanf("%d%d",&a,&b);
p=larger(&a,&b); /* It will initialize pointer p
with the address of either a or b */
printf("\nLarger - %d",*p);
getch();
}
int *larger(int *x,int *y)
{
if(*x>*y)
return x; /* address of a */
else
return y; /* address of b */
}
Thursday, July 23, 2009
FUNCTION RETURNING POINTERS
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment