StrInitCopy

Table of Contents

StrInitCopy

Description

Copy data from src to dst

Parameters

NameDirectionDescription
dstoutStr object to copy into.
srcinStr object to copy from.

Success

true

Failure

false

Usage example (Cross-references)

    
    dst->type = src->type;
    StrInitCopy(&dst->name, &src->name);
    
    return dst;
    }
    
    bool StrInitCopy(Str* dst, const Str* src) {
    ValidateStr(src);
    // Test StrInitCopy function
    bool test_str_init_copy(void) {
    printf("Testing StrInitCopy\n");
    
    Str src = StrInitFromZstr("Hello, World!");
    
    // Copy src to dst
    bool success = StrInitCopy(&dst, &src);
    
    // Validate both strings

Share :