CHAPTER 4

image

Pointers and Strings

As software developers, we could be writing code for a user-application or complex device drivers, and we use strings very frequently. A string by definition is a sequence of characters. It is stored as an array of bytes. A special string terminating character is used to mark the end of a string. The terminating character is denoted by the escape sequence, ‘\0’.

This chapter explains how a character array or string is represented in memory and how memory is allocated to store character strings. This chapter focuses on the use of pointers as a tool to manipulate the strings. Later sections discuss the common operations ...

Get Pointers in C: A Hands on Approach 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.