//Pointers comparasion
#include <stdio.h>
int* ReturnSmaller(int* p1, int* p2);
int main (void)
{
int a;
int b;
int* pSmaller = NULL;
printf("Please enter an integer: ");
scanf(" %d", &a);
printf("Please enter another integer: ");
scanf(" %d", &b);
pSmaller = ReturnSmaller(&a, &b);
printf("\n%d is the smaller value.\n\n", *pSmaller);
return 0;
}//end main
int* ReturnSmaller(int* p1, int* p2)
{
return (*p1 < *p2 ? p1 : p2);
}
Pointers
#include <stdio.h>
int* ReturnSmaller(int* p1, int* p2);
int main (void)
{
int a;
int b;
int* pSmaller = NULL;
printf("Please enter an integer: ");
scanf(" %d", &a);
printf("Please enter another integer: ");
scanf(" %d", &b);
pSmaller = ReturnSmaller(&a, &b);
printf("\n%d is the smaller value.\n\n", *pSmaller);
return 0;
}//end main
int* ReturnSmaller(int* p1, int* p2)
{
return (*p1 < *p2 ? p1 : p2);
}
Pointers
No comments:
Post a Comment