C语言基础练习题——指针<五>
1.输入a,b两个整数的值,并按大小顺序输出。
#define _CRT_SECURE_NO_WARNINGS
#include
int main(void) {
void compare(int *pointer_1, int *pointer_2);
int *pointer_1, *pointer_2, a, b;
printf("请输入a,b的值:/n");
scanf("%d %d", &a, &b);
pointer_1 = &a;
pointer_2 = &b;
printf("%d %d/n", *pointer_1, *pointer_2);
if (a < b) {
compare(pointer_1, pointer_2);
}
printf("按大小顺序输出这两个整数的值:%d > %d", a, b);
return 0;
}
共有 0 条评论