如果想一个函数返回多个值,可以考虑使用结构的办法,下面是一个使用的例子。 #include <REGX51.H> #define uchar unsigned char #define uint unsigned intstruct inf{ uchar a; uchar b; uchar c; }t1,t2; struct inf test(uchar x, uchar y, uchar z) { t1.a=x; t1.b=y; t1.c=z; return(t1); } void main() { uchar a1,a2,a3; t2=test(1,2,3); a1=t2.a; a2=t2.b; a3=t2.c;}
系统分类:
单片机 | 用户分类:
单片机
| 来源:
原创
该用户于2008/11/27 11:26:48编辑过该文章