MinGW编译器进程返回进程返回0xC00000fd

问题描述 投票:0回答:2

我正在尝试用 C 实现二叉搜索树..我正在使用带有 MinGW 编译器的 codeblocks ide

当我尝试运行以下代码时,出现运行时错误 进程返回进程返回0xC00000fd

但是当我在 http://ideone.com/ 进行编译时 它工作正常,没有任何错误

已解决:感谢@user1161318

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

struct node
{
    struct node *left;
    struct node *right;
    struct node *parent;
    int value;
}*r;

void inorder(struct node *root)
{
    int sam;
    if(root)
    {
        inorder(root->left);
        sam = root->value;
        printf(" %d ->",sam);
        inorder(root->right);
    }
}

void insert(struct node *root,int x)
{
    struct node *temp = (struct node*)malloc(sizeof(struct node));
    temp->value = x;
    struct node *y=root;
    while(root)
    {
        y = root;
        if(root->value > x)
        {
            root = root->left;
        }
        else
        {
            root = root->right;
        }
    }
    temp->parent = y;
    if(!y)
    {
        r=temp;
    }
    else if(x > y->value)
    {
        y->right = temp;
    }
    else
    {
        y->left = temp;
    }

}

int main()
{
    int i;
    for(i=0; i<10; i++)
    {
        insert(r,i);
    }
    inorder(r);
    return 0;
}
c mingw
2个回答
1
投票

全局变量

struct node *r
未在
main()
中初始化。


0
投票

我在使用 Fortran 程序时遇到此错误,当我在编译器设置中禁用 OpenMP 时,该错误消失了。由于在其他地方编译并运行您的程序是有效的,因此您可能会遇到相同或类似的问题。

© www.soinside.com 2019 - 2024. All rights reserved.