Error:.exe has triggered a breakpoint.

通常你的程序编译通过,但是在run或者debug时报错,常见原因有:
(1)在使用动态数组时,索引超出长度:

 double* a = new double[n]; //n = 3
 a[4] = 0.0; //索引只有0, 1, 2

(2)释放了分配的内存,但又使用了该变量

    char *a= (char *)malloc(10); 
    free(a); 
    strcpy(a, "hello"); 

猜你喜欢

转载自blog.csdn.net/seven_first/article/details/50600478
今日推荐