gobj_strdup()

gobj_strdup()#

gobj_strdup() duplicates a given string by allocating memory for a new copy and returning a pointer to it.

Prototype

char *gobj_strdup(
    const char *string
);

Parameters

Key

Type

Description

string

const char *

The null-terminated string to duplicate.


Return Value

A pointer to the newly allocated duplicate string, or NULL if memory allocation fails.

Notes

The returned string must be freed using gobj_free_func() to avoid memory leaks.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples