#include <iostream>
 
using namespace std;
 
void main()
{
    //int *iPtr = NULL;
    //iPtr = 5; //编译错误:error C2440: “=”: 无法从“int”转换为“int *”
    ////*iPtr = 5; // xxx.exe 中的 0x004113e8 处未处理的异常: 
////0xC0000005: 写入位置 0x00000000 时发生访问冲突
    //cout << iPtr << endl;
 
    //int *iPtr2;
    //*iPtr2 = 3; // Run-Time Check Failure #3 
////- The variable 'iPtr2' is being used without being initialized.
    
    char *cPtr = NULL;
    cPtr = "a";
    printf("%x\n", cPtr);
    cout << cPtr << endl;
 
    char *cPtr2;
    cPtr2 = "b";
    printf("%x\n", cPtr2);
    cout << cPtr2 << endl;
 
    /*
    417808
    a
    417800
    b
    请按任意键继续. . .
    */
 
}

相关文章:

  • 2021-05-31
  • 2021-09-13
  • 2021-08-04
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-21
  • 2021-10-12
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案