以下代码编译通过,而且运行正常
数组已经大大的越界,为何不出错??
编译环境vc6.0#include "stdafx.h"
#include <iostream>
using namespace std;int main(int argc, char* argv[])
{
int a[5];
for(int i = 0; i < 1000; i++)
{
a[i] = i;
cout << "a = " << a[i] << endl;
}
return 0;
}
数组已经大大的越界,为何不出错??
编译环境vc6.0#include "stdafx.h"
#include <iostream>
using namespace std;int main(int argc, char* argv[])
{
int a[5];
for(int i = 0; i < 1000; i++)
{
a[i] = i;
cout << "a = " << a[i] << endl;
}
return 0;
}
是可读的可写的。============================================================================
http://www.betajin.com/alphasun/index.htm
http://alphasun.18en.com/ http://shakingtoolkit.9126.com/
DocWizard C++程序文档自动生成工具 | Wave OpenGL | HttpProxy | AjaxParser词法分析
你的解释很有道理!但是你是如何看待经常出现的指针越界这种错误?
也就是vc题是的不能读或写这种错误呢?我想出现这种错误的时候指针指向的
地址肯定也是在这个程序的内存空间里!
谢谢指教!!
改成release模式编译后,能打印出多少?我想可能运行不了了。
在我的机器上面试不了了。