f要返回一个值?怎么改
# include <stdio.h>int f(int * p, int * q);
void main(int)
{
int a = 3;
int b = 5;
f(&a, &b);
printf("a = %d, b = %d\n", a , b);
return ;
}
int f(int * p, int * q)
{
int t;
t = *p;
*p = *q;
*q = t;
}
运行结果:'f' : must return a value 改成
void f(int * p, int * q)
{
int t;
t = *p;
*p = *q;
*q = t;
}
或者
int f(int * p, int * q)
{
int t;
t = *p;
*p = *q;
*q = t;
return 0;
}
页:
[1]