本文介绍了使用calloc / malloc时有助于警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我是新手。请帮忙。以下警告由gcc-3.2.2 编译器(pc Linux)发出: ================= ================================= ================ read_raw_data.c:51:警告:赋值使得整数指针 没有演员 =========== ======================================= =========== ===== 编译下面的代码时。违规声明 是calloc。 main()函数中的类似语句没有任何 警告。我只允许在main()或 内使用calloc(和malloc)我做的事情非常愚蠢吗? ========== =================================== init(char *文件,双* grid,\ double * start){ double * depth; int pts depth = calloc(pts,sizeof(double)); } =================== ========================= 谢谢。 MKI am a newbie. Please help. The following warning is issued by gcc-3.2.2compiler (pc Linux):================================================== ================read_raw_data.c:51: warning: assignment makes pointer from integerwithout a cast================================================== ================when the following piece of code was compiled. The offending statementis calloc. A similar statement in the main() function passes without anywarning. Am I allowed to use calloc (and malloc) only within main() oram I doing something very silly ??=============================================init(char *file, double *grid, \double *start){double *depth;int ptsdepth = calloc(pts,sizeof (double));}============================================Thanks.MK推荐答案 您是否包括stdlib.h? TomDid you include stdlib.h?Tom 这是迟钝的。首先,错误时他们将返回NULL。 第二位我的taquitos! TomThis is retarded. First off, on error they will return NULL anyways.Second where are my taquitos!Tom 这篇关于使用calloc / malloc时有助于警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 06-22 07:08