为什么cygwin下运行释放内存释放错误的程序不报运行时错误?

x-teamer团队 x-teamer团队 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
下面这段程序在VS2005下会报一个运行时错误,原因是内存释放错误, 但Cygwin下为什么运行可以安全通过?

100分相送,期待高手解答.

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
struct A
{
int a;
char b;
};

struct B
{
int a;
char b;
int c;
};

int main(void )
{
A *a = NULL;
a = (A*) malloc(sizeof(A));
memset(a, 0, sizeof(B));
free(a);
printf("helloWOrld");
}
...全文

相关推荐

评论 15
收藏 已收藏
分享
返回顶部
x-teamer团队
C语言 70,039 成员 243,237 内容