A string in C is a sequence of characters stored in an array of type char and terminated by a null character ('\0').
Note: scanf() stops reading at whitespace.
Note: gets() is unsafe and not recommended.
(Require #include )
| Function | Description |
|---|---|
strlen() | Finds length |
strcpy() | Copies string |
strcat() | Concatenates strings |
strcmp() | Compares strings |
strlwr() | Converts to lowercase |
strupr() | Converts to uppercase |
Character array may not end with '\0'
String must end with '\0'
Strings are character arrays ending with null character
Stored using char type
string.h provides string functions
fgets() is safer for input
Take quizzes related to this topic and see where you stand!
Start Quiz Now