void * malloc(size_t num_bytes); [英] void *malloc(size_t num_bytes);

查看:100
本文介绍了void * malloc(size_t num_bytes);的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在阅读c ++ builder complete

reference中有关c指针的章节。并且据说malloc返回指向分配的内存的

开始的指针,但我看到它的原型说无效

* malloc(----) ;

无效意味着该函数不返回任何内容?

感谢

Hi,
i was reading a chapter about c pointers in "c++builder complete
reference" and it is said there that malloc returns a pointer to the
start of the memory allocated but i see the prototype of it saying void
*malloc(----);
does not void mean that the function does not return anything?
thanks

推荐答案

Alawna写道:

我正在阅读c ++ builder complete
reference中有关c指针的章节。并且据说malloc返回一个指向分配的内存开始的指针,但我看到它的原型说无效
* malloc(----);
不会无效意味着该功能不返回任何内容?
感谢
Hi,
i was reading a chapter about c pointers in "c++builder complete
reference" and it is said there that malloc returns a pointer to the
start of the memory allocated but i see the prototype of it saying void
*malloc(----);
does not void mean that the function does not return anything?
thanks




A" void *"大致意思是指向某事物的指针。因此,malloc

函数返回一个指向内存位置的指针,在那里你可以存储

的东西。


查看你的部分指针。不要混淆无效带有void *。


Mark F. Haigh
mf ** ***@sbcglobal.net



A "void *" means roughly "a pointer to something". Thus, the malloc
function returns a pointer to a memory location where you can store
something.

Review your section on pointers. Don''t confuse "void" with "void *".

Mark F. Haigh
mf*****@sbcglobal.net


谢谢

thanks


所以让我们假设malloc返回一个整数然后它的原型

将是int void * malloc(-----); 。这是准确的吗?

so let us suppose that malloc returns an integer then its prototype
would be int void *malloc(-----); . is this accurate?


这篇关于void * malloc(size_t num_bytes);的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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