书法字典:https://www.shufadict.com

任意地址赋值,编译没问题,运行时错误

==

#include <iostream>
using namespace std ;

int main(void)
{
    int *p = (int*)1234; //编译没问题,但运行时出错
    *p = 190 ; // not writeable

    system("pause") ;
    return 0 ;
}

// output: run time error! access voilation!

==

posted on 2009-07-27 14:53  翰墨小生  阅读(399)  评论(1编辑  收藏  举报

导航

书法字典:https://www.shufadict.com