3 ms·
Doesn't seem so fine to me.. /*compare.c*/ #include <stdio.h> int compare( int x, int y ) { return x - y; } void testCompare( int x, in
by imron 12y ago
Doesn't seem so fine to me..
/*compare.c*/
#include <stdio.h>
int compare( int x, int y )
{
return x - y;
}
void testCompare( int x, int y )
{
if ( compare( x, y ) < 0 )
{
printf( "%d is less than %d\n", x, y );
}
else
{
printf( "%d is greater than or equal to %d\n", x, y );
}
}
int main()
{
testCompare( 5, 10 );
testCompare( 10, 5 );
testCompare( 1987654321, -1987654321 );
return 0;
}
$ clang -o compare compare.c
$ ./compare
5 is less than 10
10 is greater than or equal to 5
1987654321 is less than -1987654321