Calloc of“unsigned char my_bytes [256] [256]" [英] Calloc of "unsigned char my_bytes[256][256]"
问题描述
参见主题:我如何calloc(并释放内存,如果那不是
免费(my_bytes);)这个?
TIA!
See subject: how do I calloc (and free the memory, if that''s not
free(my_bytes);) this?
TIA!
推荐答案
M-One写道:
M-One wrote:
查看主题:我如何calloc(并释放内存,如果那不是免费的(my_bytes);)这个?
TIA!
See subject: how do I calloc (and free the memory, if that''s not
free(my_bytes);) this?
TIA!
>
学习如何阅读位于以下位置的常见问题解答的良好开端:
http://www.eskimo.com/~scs/C-faq/top.html
问题6.16讨论这个主题。
http:// www.eskimo.com/~scs/C-faq/q6.16.html
-
Al Bowers
佛罗里达州坦帕市
mailto: xa*@abowers.combase.com (删除x)
http://www.geocities.com/abowers822/
A good start on learning how would be to read the faq located at:
http://www.eskimo.com/~scs/C-faq/top.html
Question 6.16 discuss this topic.
http://www.eskimo.com/~scs/C-faq/q6.16.html
--
Al Bowers
Tampa, Fl USA
mailto: xa*@abowers.combase.com (remove the x)
http://www.geocities.com/abowers822/
M-One< sp *** @ uni-one.nl>在消息中写道
news:3F *************** @ uni-one.nl ...
M-One <sp***@uni-one.nl> wrote in message
news:3F***************@uni-one.nl...
参见主题:如何我是calloc(并释放内存,如果那不是免费的(my_bytes);)这个?
See subject: how do I calloc (and free the memory, if that''s not
free(my_bytes);) this?
您是否尝试过查找文档for calloc
和免费?
#include< stdio.h>
#include< stdlib.h>
int main()
{
unsigned char * my_bytes = calloc(256 * 256,sizeof * my_bytes);
if(my_bytes == NULL)
{
fprintf(stderr,无法分配内存);
返回EXIT_FAILURE;
}
/ *无论* /
免费(my_bytes);
返回EXIT_SUCCESS;
}
-Mike
Have you tried looking up the documentation for calloc
and free?
#include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned char *my_bytes = calloc(256 * 256, sizeof *my_bytes);
if(my_bytes == NULL)
{
fprintf(stderr, "Cannot allocate memory");
return EXIT_FAILURE;
}
/* whatever */
free(my_bytes);
return EXIT_SUCCESS;
}
-Mike
> ;>参见主题:如何调用calloc(并释放内存,如果那不是
>> See subject: how do I calloc (and free the memory, if that''s not
free(my_bytes);)这个?
free(my_bytes);) this?
您是否尝试过查找calloc的文档
并免费?
Have you tried looking up the documentation for calloc
and free?
是的;谢谢你的例子。
Yes; thanks for the example.
这篇关于Calloc of“unsigned char my_bytes [256] [256]"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!