Published online by Cambridge University Press: 17 July 2025
In the last chapter, we discussed about single and multi dimensional array. We already learnt how to define arrays of different sizes and dimensions, how to initialize them, how to operate on arrays of different dimensions, etc. With this knowledge, we are ready to handle strings, which are, simply a special kind of array. String handling basically consists of:
Σ Input and output strings from/to keyboard/monitor or files.
Σ Copying and comparing strings with library functions.
Σ Finding substrings, determining length, extracting substring, concatenating strings with library functions.
Σ Manipulating case of characters in a string with library functions.
Σ Writing equivalent functions of string manipulating library functions.
We will discuss all important string manipulating library functions in this chapter; however a complete list of string manipulating library functions along with explanation is given in Appendix.
We will learn to write equivalent functions of string manipulating library functions in functions chapter.
STRING
A string is a sequence of characters terminated with a null character (‘\0’). It is usually stored as one-dimensional character array. A set of characters arranged in any sequence defined within double quotation is known as string constant. To manipulate text such as words and sentences, strings, i.e., character arrays are used. The way a group of integers can be stored in an integer array, is similar with a group of characters stored in a character array.
To save this book to your Kindle, first ensure no-reply@cambridge-org.demo.remotlog.com is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.