hi all, im new to pointers and im having problems with the program below, theres an error with pointer argument.
What i want it to basically do is to get two numbers, compare them, highest one is stored in one pointer, and the other in another pointer.
Code:
#include <stdio.h>
void int_sort(int*,int*);
int main()
{
int val1, *pval1, val2, *pval2;
printf( "Enter two numbers: " );
scanf( "%d %d", val1, val2);
pval1 = &val1;
pval2 = &val2;
int_sort(pval1,pval2);
printf( "val1: %d\tval2: %d\n", val1, val2 );
return 0;
}
void int_sort( int *pval1, int *pval2 )
{
int store;
if ( *pval1 > *pval2 )
store = *pval1;
else
store = *pval2;
}