C语言 通过union共存体释放常量指针指向的堆空间
摘要:
union共存体中所有成员占用相同的内存空间。因为free函数参数是void *,常量指针是const void *,所以free函数释放常量指针时会因类型不同而失败。 #include <stdio.h> #include <malloc.h> #include <string.h> typede 阅读全文
posted @ 2023-10-15 10:31 王景迁 阅读(25) 评论(0) 推荐(0) 编辑