The string library
Copy, join and compare C strings with strcpy, strcat, strcmp and snprintf, and learn why each one trusts you to leave room for the zero byte.
- The skill
- Copy, join, compare and build C strings with the standard library without writing past the end of an array.
- You make
- A safe gamer tag builder, two memory and comparison bug fixes, a register search and a playlist sorter.
Premium lesson
£7.99 a month or £59 a year. Cancel any time.
Builds on 14 Checkpoint: functions, arrays and pointers. Free to try: C Foundations and the playground.
Passed
You can now
Step 1 of 9
exercise_1.c
You've reached the good stuff.
5 exercises in this lesson, checked as you type. Premium opens every lesson after Foundations, in all four courses.
C, 32-bit: int and pointers are 4 bytes