我定义了一个函数但是好像是调用失败了,求大神来看看
#include<stdio.h>
void swap(int*,int*);
int main(void){
int x,y;
printf("please type x\n");
scanf("%d",&x);
printf("please type y\n");
scanf("%d",&y);
printf("x is %d,and y is %d\n",x,y);
swap(&x, &y);
printf("now x is %d,y is %d\n",x,y);
}
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
[/code]
程序到swap(&x,&y )就断了
还有本来我不想用两个scanf()的,但是我要是scanf("%d,%d",&x,&y)就只能输入x, 输入完x回车后程序直接执行下一行 |
|