如题

解决方案 »

  1.   

    试过就知道了 不会报错!
    测试如下:
             const int LENGTH = 3;
    char *sample = "this is a sample";
    char *str = (char *)(malloc(strlen(sample)+1));
    str = (char *)realloc(str , LENGTH);
    free(str);
      

  2.   

    那么执行 ReAlloc 时报错 ,到底可能是什么原因造成的呢??
      

  3.   

    试过,不会报错 BYTE   *pData; pData  = (BYTE *)malloc(16); memset(pData,0x50,16); pData = (BYTE *)realloc(pData, 5); memset(pData,0xa5,5);
      

  4.   

    在realloc中 执行到  _CrtIsValidHeapPointer   时报的错。这是什么错??