CHAPTER 19 / 26
C Strings
Learn how to work with character arrays and C strings.
01 — Syntax
char name[] = "text";
02 — Example
#include <stdio.h>
int main() {
char name[] = "AIFA";
printf("Name: %s", name);
return 0;
}03 — Important Points
- C strings end with a null character.
- Use %s with a character string.
04 — Common Mistakes
- Forgetting the null terminator when manually building strings.
- Using an incompatible format specifier.
05 — Real-World Use
Strings are used for names, messages, paths and text processing.
06 — Practice
Create a small program that demonstrates the main idea of C Strings.