Udostępnij za pośrednictwem


CArray::SetAt

Sets the array element at the specified index.

void SetAt(
   INT_PTR nIndex,
   ARG_TYPE newElement 
);

Parameters

  • nIndex
    An integer index that is greater than or equal to 0 and less than or equal to the value returned by GetUpperBound.

  • ARG_TYPE
    Template parameter specifying the type of arguments used for referencing array elements.

  • newElement
    The new element value to be stored at the specified position.

Remarks

SetAt will not cause the array to grow. Use SetAtGrow if you want the array to grow automatically.

You must ensure that your index value represents a valid position in the array. If it is out of bounds, then the Debug version of the library asserts.

Example

See the example for GetAt.

Requirements

Header: afxtempl.h

See Also

Reference

CArray Class

Hierarchy Chart

CArray::GetAt

CArray::SetAtGrow

CArray::ElementAt

CArray::operator []

Other Resources

CArray Members