具体来说,我想知道我是否可以做这样的事情:
typedef struct {
    char *s; /* still a cstr, with '0' bit at end */
    size_t len;
} str;
str *newstr(char *s) {/*...*/};
void freestr(str *s) {/*...*/};
并做这样的事情(将其视为具有stdlib/string功能的 cstr):
int main() {
    str *s = newstr("hello");
    printf("The first character of '%s' is '%c'", *s, (*s)[0]);
    freestr(s);
}
如果不是,这没什么大不了的——当然,我并不真正担心浪费一个字节。