Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Strings – Character Arra | C Programming Fundamentals lesson | BraveProgrammer
  1. Courses
  2. /
  3. C Programming Fundamentals

Lesson 16 of 50

·c

Strings – Character Arrays

9 mins

Course progress32%

What you'll learn

Keep these ideas in mind as you work through the lesson.

4 points
  • A C‑string ends with a null character `\0`.
  • `strlen(s)` returns the length **excluding** the null terminator.
  • `strcpy` can overflow – prefer `strncpy` with a size argument.
  • String literals are read‑only; modifying them causes undefined behavior.

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).

Make it stickPractice what you've learned1 quiz · 3 practical tests · Optional activities from C Programming FundamentalsBrowse activities
Previous lessonArraysContinue to lesson 17Dynamic Memory – malloc & freeBack to C Programming Fundamentals curriculum