ANSI C : test return from calloc API

This question already has an answer here:

  • Why does malloc(0) return a non-null address in Windows? 5 answers

  • As the documentation from cppreference says:

    If size is zero, the behavior is implementation defined (null pointer may be returned, or some non-null pointer may be returned that may not be used to access storage)

    Just don't do that.

    http://en.cppreference.com/w/cpp/memory/c/calloc

    链接地址: http://www.djcxy.com/p/79910.html

    上一篇: MinGW不会产生警告

    下一篇: ANSI C:从calloc API返回测试结果