O'Reilly logo

C Interfaces and Implementations: Techniques for Creating Reusable Software by David R. Hanson - Princeton University

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required