会员
周边
众包
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
我脑袋不好使,可偏偏是学计算机的
笨啊还有点浮躁
博客园
首页
新随笔
联系
管理
订阅
c返回数组
#i nclude
<
stdio.h
>
int
*
test(
int
*
b);
int
*
array;
int
main()
{
int
a
=
1
,c;
int
*
temp;
temp
=
test(
&
a);
for
(c
=
0
; c
<
a; c
++
)
{
printf(
"
temp[%d]=%d\n
"
,c,temp[c]);
}
getch();
}
int
*
test(
int
*
b)
{
int
a;
for
(a
=
0
; a
<
10
; a
++
)
{
array[a]
=
a;
}
*
b
=
a;
return
array;
}
2
。传参数
#i nclude
<
stdio.h
>
void
test(
int
*
b,
int
*
array);
int
main()
{
int
a
=
1
,c;
int
temp[
10
];
test(
&
a, temp);
for
(c
=
0
; c
<
a; c
++
)
{
printf(
"
temp[%d]=%d\n
"
,c,temp[c]);
}
getch();
}
void
test(
int
*
b,
int
*
array)
{
int
a;
for
(a
=
0
; a
<
10
; a
++
)
{
array[a]
=
a;
}
*
b
=
10
;
}
posted @
2007-04-05 18:01
fool
阅读(
1080
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告