Skip to content
StrForeachPtrReverse

StrForeachPtrReverse

Description

Walk each character of str backward, binding chrptr to a pointer to the current character. Use when the body needs to mutate characters in place. See VecForeachPtrReverse for the full SUCCESS/FAILURE contract.

Usage example (Cross-references)

Usage examples (Cross-references)
    // Test StrForeachPtrReverse macro
    bool test_str_foreach_ptr_reverse(void) {
        WriteFmt("Testing StrForeachPtrReverse\n");
        DefaultAllocator alloc = DefaultAllocatorInit();
        size char_count = 0;
    
        StrForeachPtrReverse(&s, chrptr) {
            // Append the character (via pointer) to the result string
            StrPushBackR(&result, *chrptr);
Last updated on