请求修改一个程序,不知道为什么会这样呢
#include "stdio.h"main()
{void swap(int,int);
int a,b;
a=3;b=4;
swap(a,b);
printf("%d,%d\n",a,b);
}
void swap(int x,int y)
{int t;
t=x;x=y;y=t;
}
小弟不才,请求指教!
2006-03-27 21:18
2006-03-27 21:44
2006-04-03 06:59
2006-04-03 07:01
2006-04-03 17:17
当然..外部声明和main()函数声明都可以~!~(如果所有函数都定义在主函数下面.而且仅仅供主函数调用的话)

2006-04-03 17:28
我记得C语言的书指针那一章的第一个例子就是它了..
2006-04-04 13:35
给你参照一下:
#include<stdio.h>
main()
{
void swap();
int a=3,b=4;
printf("%d,%d\n",a,b);
swap(&a,&b);
printf("%d,%d\n",a,b);
}
void swap(x,y)
int *x,*y;
{
int temp;
temp=*x;
*x=*y;
*y=temp;}
2006-04-04 14:04
)

2006-04-04 14:32

2006-04-04 15:19