Strings as char Arrays
A C string is a char array ending with \0. Strings are not a separate type.
Example
#include <stdio.h>
int main(void) {
char s[] = "Hello";
printf("%s %zu %c\n", s, sizeof s, s[1]);
char t[6] = {'H', 'i', '\0'};
printf("%s\n", t);
return 0;
}Result
Hello 6 e Hi
Exercise
String end marker.
The string ends with \Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.