Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

15.3. Implementation

<str.c>≡
   #include <string.h>
   #include <limits.h>
   #include "assert.h"
   #include "fmt.h"
   #include "str.h"
   #include "mem.h"

   <macros 251>
   <functions 252>

The implementation must deal with converting positions to indices and vice versa, because the functions use indices to access the actual characters. The index of the character to the right of the positive position i is i − 1. The index of the character to the right of a negative position i is i + len, where len is the number of characters in the string. The macro


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint