1 #include
2 #include
3
4 void compare(int *m,int *n){
5 printf("compare\n");
6 if(*m>*n){
7 printf("%d>%d\n",*m,*n);
8 }
9 else if(*m<*n){
10 printf("%d<%d\n",*m,*n);
11 }else{
12 printf("%d=%d\n",*m,*n);
13 }
14 }
15
16 int main(void){
17 printf("请输入两个整数:");
18 int a,b;
19 scanf("%d%d",&a,&b);
20 compare(&a,&b);
21 }
~
#include "stdio.h"
int comp(int * a,int *b) //a>b return 1;a=b return 0;a{
int c = *a - (*b);
if(c>0)return 1;
if(c==0)return 0;
if(c<0)return -1;
}
int main(int argc, char* argv[])
{
int * n1,*n2;
int a =100,b=200;
n1 =&a;
n2 =&b;
printf("%d\n",comp(n1,n2));
return 0;
}
#include
int intcmp(int*p,int*q)
{if(*p>*q)return 1;
else ig(*p==*q)return 0;
return -1;
}
int main()
{int a,b,c;
scanf("%d%d",&a,&b);
c=intcmp(&a,&b);
if(c==1)printf("a>b\n");
else if(c==0)printf("a==b\n");
else printf("areturn 0;
}