void swap(int*,int*);这句是函数申明吗,怎么放在main函数里面?
程序代码:
# include <stdio.h> void swap(int * p, int * q) { int temp; if (*q > *p) { temp = *p; *p = *q; *q = temp; } } int main(void) { int a, b; int * p1, * p2; printf("请输入两个数:\n"); scanf("%d %d", &a, &b); p1 = &a; p2 = &b; swap(p1, p2); printf("%d %d\n", *p1, *p2); return 0; }