Array::SetSize

Description

Updates array size to the requested size

Syntax

BOOL SetSize( int nNewSize )

Parameters

nNewSize
[input] The requested new size of the array

Return

Returns a boolean indicating success or failure of the requested operation

Examples

EX1

#include <Array.h>
struct PERSON
{
        int nID;
};

void Array_SetSize_ex1()
{
        Array<PERSON&> arp(true);
        int nOldSize = arp.GetSize(); //should be zero;
        int nNewSize = 10;
        //set the size of the array as 10
        if ( arp.SetSize(nNewSize) )
        {
                printf("Set the size of the array as %d successfully.\n", arp.GetSize());
        }
        else
                printf("Fail to set the size of the array as %d.\n", nNewSize);
}

Remark

See Also

Array::GetSize

Header to Include

Array.h