Summary
A string is a series of characters treated as a unit. In C, strings are represented by a series of characters terminated by the null character, which is the character whose ASCII code is 0. Strings can be stored in character arrays. An array is a series of items, or elements, all of the same type. To declare an array called name and having 30 elements of type char, do the following:
char name[30];
Be sure to allot a number of elements sufficient to hold the entire string, including the null character.
String constants are represented by enclosing the string in double quotes: "This is an example of a string".
The strlen() function can be used to find the length of a string (not counting the terminating null character). The scanf() function, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access