new 数组越界 系统不会报错

/** \brief
    测试 数组越界 , 系统是否有报错
 *
    测试结果: 不报错
 *
 * \param
 * \param
 * \return
 *
 */
#include <iostream>



using std::cout ;

int main(){

    int * ary = new int [100];

    std::cout << "ary[101] = " << ary[101] << std::endl;

    std::cin.get();

    std::cout << "ary[1000] = " << ary[1000] << std::endl;

    std::cin.get();

    return 0;
}
结果:
ary[101] = 0

ary[1000] = 0


Process returned 0 (0x0) execution time : 1.685 s
Press ENTER to continue.

猜你喜欢

转载自javaeye-hanlingbo.iteye.com/blog/2414117