弱弱的请教一个指针做函数参数的问题?
下面的程序怎么老是出错啊?#include <stdio.h>
void swap(float *p1,float *p2)
{
float temp;
temp=*p1;*p1=*p2;*p2=temp;
} │
main() │
{ │
float a=10,b=5; │
printf("%d,%d\n",a,b); │
float *pointer_1=&a; │
float *pointer_2=&b;
swap(pointer_1,pointer_2);
printf("%d,%d",a,b);
}
│
├────────────────────────────────── Message ───────────────────────────────────┤
│•Compiling C:\TURBOC2\C2.C: │
│ Error C:\TURBOC2\C2.C 11: Expression syntax in function main │
│ Error C:\TURBOC2\C2.C 12: Expression syntax in function main │
│ Error C:\TURBOC2\C2.C 13: Undefined symbol 'pointer_1' in function main │
│ Error C:\TURBOC2\C2.C 13: Undefined symbol 'pointer_2' in function main │
│ Warning C:\TURBOC2\C2.C 13: Non-portable pointer conversion in function main │
│ Warning C:\TURBOC2\C2.C 13: Non-portable pointer conversion in function main │
└──────────────────────────────────────────────────────────────────────────────┘
F1-Help F5-Zoom F6-Switch F7-Trace F8-Step F9-Make F10-Menu NUM
[此贴子已经被作者于2005-9-16 20:01:35编辑过]