程序接收信号SIGTRAP,跟踪/断点陷阱。调试需要帮助

时间:2014-06-18 07:56:49

标签: c debugging malloc free

该计划:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    char *a = (char *)malloc(5);
    printf("say hello\n");
    scanf("%s", a);
    if(!strcmp(a,"hello"))
        printf("\n hello");
    else
        printf("\n say hello");
    free(a);
    system("PAUSE");
    return 0;
}

该程序使用代码块编写,使用c编译并在Windows 7中运行。 可能导致此错误的原因(Program received signal SIGTRAP, Trace/breakpoint trap.)?

提前致谢。

0 个答案:

没有答案