7

String Operations and Standard Functions

CHAPTER OUTLINE
7.1 DEFINITION OF STRING

String is defined as an array of characters. In the text, we find words and sentences and they are normally controlled by strings. Every string is terminated with ‘\0(NULL)character.

An example of a string is as follows:

char name[ ]={‘I’,‘N’,‘D’,‘I’,‘A’,‘\0’};

In C, each character of the string occupies 1 byte of memory. The last character is always ‘\0’. It is not compulsory to write ‘\0’ in a string. The compiler automatically puts ‘\0’ at the end of a character array or string. The characters of string ...

Get C Programming 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.