声明一个返回指向1-d数组的指针的函数 [英] declaring a function that returns a pointer to 1-d array

查看:62
本文介绍了声明一个返回指向1-d数组的指针的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何声明一个向一维数组返回指针

的函数?

How can I declare a function that returns a pointer
to one dimensional array ?

推荐答案

ju**********@yahoo.co.in 上写道17/09/05:
ju**********@yahoo.co.in wrote on 17/09/05 :
如何声明一个将指针返回到一维数组的函数?
How can I declare a function that returns a pointer
to one dimensional array ?




Do你最好的努力和发布它。这是基本的。


(提示:malloc())


-

Emmanuel

C-FAQ: http: //www.eskimo.com/~scs/C-faq/faq.html

C库: http://www.dinkumware.com/refxc.html



Do your best effort nd post it. It''s basic.

(hint : malloc())

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

..sig under repair


(取代< mn *********************** @ YOURBRAnoos.fr>)

ju ********** @ yahoo.co.in 写于17/09/05:
(supersedes <mn***********************@YOURBRAnoos.fr>)

ju**********@yahoo.co.in wrote on 17/09/05 :
如何声明一个将指针返回到一维数组的函数?
How can I declare a function that returns a pointer
to one dimensional array ?




尽你所能并发布它。这是基本的。


(提示:malloc())

-

Emmanuel

C-FAQ: http:// www。 eskimo.com/~scs/C-faq/faq.html

C库: http://www.dinkumware.com/refxc.html


" Mal nommer les choses c''est ajouter du malheur au

monde。 - Albert Camus。



Do your best effort and post it. It''s basic.

(hint : malloc())
--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Mal nommer les choses c''est ajouter du malheur au
monde." -- Albert Camus.


ju *** *******@yahoo.co.in 写道:
如何声明一个将指针返回到一维数组的函数?
How can I declare a function that returns a pointer
to one dimensional array ?



就像你声明任何其他功能一样,只需记住

局部变量的范围仅限于函数内。所以你必须

返回一个指向动态分配内存的指针,或者返回一个静态变量。


欢呼,

forayer


-

如果你真的是一个真正的追求者,那么你生命中至少需要

尽可能地怀疑所有事情。

- Rene Descartes


Like you declare any other funtion, just remember that the scope of
local variables are restricted to within the function. So you have to
return a pointer to dynamically allocated memory, or to a static variable.

cheers,
forayer

--
If you would be a real seeker after truth, it is necessary that at least
once in your life you doubt, as far as possible, all things."
-- Rene Descartes


这篇关于声明一个返回指向1-d数组的指针的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆