What does malloc(0) return? [duplicate]
Others have answered how malloc(0) works. I will answer one of the questions that you asked that hasn’t been answered yet (I think). The question is about realloc(malloc(0), 0): What does malloc(0) return? Would the answer be same for realloc(malloc(0),0)? The standard says this about realloc(ptr, size): if ptr is NULL, it behaves like malloc(size), … Read more