VecEnd

Table of Contents

VecEnd

Description

Pointer at the end (after last element) of vector

Parameters

NameDirectionDescription
vinVector to get end of.

Usage example (Cross-references)

    // Test VecBegin and VecEnd functions
    bool test_vec_begin_end(void) {
    WriteFmt("Testing VecBegin and VecEnd\n");
    
    // Create a vector of integers
    // Get begin and end pointers
    int  *begin = VecBegin(&vec);
    char *end   = (char *)VecEnd(&vec);
    
    // Check that begin points to the first element
    /// Get pointer to one past the last character in string
    ///
    #define StrEnd(str) VecEnd(str)
    
    ///
    
    case VEC_INT_END : {
    volatile void *end_ptr = VecEnd(vec);
    (void)end_ptr;
    break;
    case VEC_STR_END : {
    if (VecLen(vec) > 0) {
    char *end = VecEnd(vec);
    (void)end; // Use the result to avoid warnings
    }
    case VEC_CHAR_PTR_END : {
    if (VecLen(vec) > 0) {
    char *end = VecEnd(vec);
    (void)end; // Use the result to avoid warnings
    }

Share :