重新分配的内存块
void *realloc(
void *memblock,
size_t size
);
动态增加数组大小
TYPE* pDataNew = ( TYPE* )realloc( m_pData, nNewMaxSize * sizeof( TYPE ) );
if( pDataNew == NULL )return E_OUTOFMEMORY;
m_pData = pDataNew;
m_nMaxSize = nNewMaxSize;
///
从一个位置移动到另一个内存块。
void MoveMemory( __in PVOID Destination, __in const VOID* Source, __in SIZE_T Length ); 数组下标nIndex中插入元素TYPE* pDataNew = ( TYPE* )realloc( m_pData, m_nSize * sizeof( TYPE ) );
if( pDataNew == NULL ) return E_OUTOFMEMORY; m_pData = pDataNew; MoveMemory( &m_pData[nIndex + 1], &m_pData[nIndex], sizeof( TYPE ) * ( m_nSize - nIndex ) ); m_pData[nIndex] = value; ++m_nSize;