home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tyc
/
list18_4.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-16
|
618b
|
36 lines
/* Function that returns a pointer. */
#include <stdio.h>
int larger1(int x, int y);
int *larger2(int *x, int *y);
main()
{
int a, b, bigger1, *bigger2;
printf("Enter two integer values: ");
scanf("%d %d", &a, &b);
bigger1 = larger1(a, b);
printf("\The larger value is %d.", bigger1);
bigger2 = larger2(&a, &b);
printf("\nThe larger value is %d.", *bigger2);
}
int larger1(int x, int y)
{
if (y > x)
return y;
return x;
}
int *larger2(int *x, int *y)
{
if (*y > *x)
return y;
return x;
}