Lesson 16 of 50
cStrings – Character Arrays
9 mins
Course progress32%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 16 of 50
c9 mins
Keep these ideas in mind as you work through the lesson.
C does not have a built‑in string type. Strings are arrays of char terminated by a null byte ('\0').
char name[6] = {'J','o','h','n','\0'}; // explicit
char greeting[] = "Hello"; // compiler adds '\0'
Standard library <string.h> offers functions like strlen, strcpy, strcat, strcmp. Always ensure destination buffers are large enough (use strncpy, strncat).