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按钮关闭时,调试器会显示上述错误,相关截图如下:

内容的提问来源于stack exchange,提问作者3nondatur
相关产品推荐
相关产品推荐

