Skip to content

VecReverse

Description

Reverse the elements of the vector in place.

Parameters

Name Direction Description
v in,out Vector handle.

Success

Returns to the caller. The element at index i is now the element that was previously at index length - 1 - i. The vector length is unchanged.

Failure

Function cannot fail.

Usage example (Cross-references)

Usage examples (Cross-references)
    
            case VEC_CHAR_PTR_REVERSE : {
                VecReverse(vec);
                break;
            }
    
            case VEC_STR_REVERSE : {
                VecReverse(vec);
                break;
            }
            // Advanced operations
            case VEC_INT_REVERSE : {
                VecReverse(vec);
                break;
            }
    // Test VecReverse function
    bool test_vec_reverse(void) {
        WriteFmt("Testing VecReverse\n");
    
        // Create a vector of integers
    
        // Reverse the vector
        VecReverse(&vec);
    
        // Check that the elements are reversed
    
        // Reverse again to get back to the original order
        VecReverse(&vec);
    
        // Check that the elements are back in the original order
    
        // Reverse the vector
        VecReverse(&vec);
    
        // Check that the elements are reversed
    /// TAGS: Str, Memory, Reverse
    ///
    #define StrReverse(str) VecReverse((str))
    
    ///
Last updated on