You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Code Blocks运行C代码出现-1073741510错误,求原因排查

排查C代码运行时错误:Process terminated with status -1073741510

我在Code Blocks中运行以下C代码时,点击控制台窗口的X按钮关闭程序,调试器会报错Process terminated with status -1073741510,怀疑是内存操作存在问题,烦请帮忙排查错误原因。

代码如下:

#include <stdio.h>
#include <stdlib.h>

typedef struct _point_ {
    int x_;
    int y_;
} point;

point* createPointOnHeap(int x, int y)
{
    point* my_point = malloc(sizeof(*my_point));
    if (my_point == NULL)
    {
      printf("Out of memory!\n");
      return NULL;
    }
    my_point -> x_ = x;
    my_point -> y_ = y;
    printf("x = %d \n", my_point -> x_);
    printf("y = %d \n", my_point -> y_);
    return my_point;
}

void givePointMemoryBackToHeap(point* my_point)
{
    free(my_point);
}

int main()
{
  int x = 5;
  int y = 3;

  point* my_point = createPointOnHeap(x,y);
  givePointMemoryBackToHeap(my_point);

  return 0;
}

补充说明:运行该控制台程序后,点击控制台窗口的X按钮关闭时,调试器会显示上述错误,相关截图如下:
控制台报错截图1 调试器报错截图2

内容的提问来源于stack exchange,提问作者3nondatur

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 01:14:55