C Collections

cstring · Section 3

cstr_construct

cstr_construct - declare and initialise a cstr in one step

C Collections (libccollections, -lccollections)

#include <ccollections/cstring.h>
 
cstr_construct(s, initial);

This macro does cstr_declare() and cstr_init() in one statement. It
creates a new cstr variable named s and initialises it with the content
you give.

s        Variable name to create
initial  Initial content (C string or NULL for empty string)

cstr_construct(greeting, "Hello");
cstr_append(greeting, ", world!");
cstr_destroy(greeting);

cstr_construct_scoped(3), cstr_construct_mp(3), cstr_declare(3), cstr_init(3)