Strings
Strings
Strings are immutable. Once created, their contents cannot be Strings can have varying lengths. This allows us to represent
directly changed. text of different sizes.
String Types in C
Strings in C come in two main categories fixed length and variable length
: .
of the text
.
Variable Length Strings: Two
Types
Variable length strings can be further categorized into two types: length
controlled and delimited.
strcat() strcmp()
Concatenates (appends) one string Compares two strings
to the end of another. lexicographically. Returns 0 if they
are equal.
String Copy: strcpy() and strncpy()
The strcpy() function copies the contents of one string to another, including the null character. But it can overwrite memory if the
source string is longer.
2 String Functions