Chapter 16. High-Level Strings
The functions exported by the Str
interface described in the previous chapter augment the conventions for handling strings in C. By convention, strings are arrays of characters in which the last character is null. While this representation is adequate for many applications, it does have two significant disadvantages. First, finding the length of a string requires searching the string for its terminating null character, so computing the length takes time proportional to the length of the string. Second, the functions in the Str
interface and some of those in the standard library assume that strings can be changed, so either they or their callers must allocate space for string results; in applications that do not modify ...
Get C Interfaces and Implementations: Techniques for Creating Reusable Software now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.