Module 04 of 11

Arrays & Strings

Lessons

About This Module

So far each variable has held a single value. Real programs work with collections: a list of scores, a grid of tiles, a line of text. In C those collections are built from arrays, and this module shows you how to use them.

It starts with one-dimensional arrays and moves on to 2D arrays with nested loops. Then it turns to strings, which C represents as arrays of characters ending in a null terminator, and finishes with the string library functions for measuring, copying, joining, and comparing text.

Watch the lessons in order, then continue on to Control Flow & Loops.

Lessons

5 videos
01

Arrays

The freeCodeCamp C course chapter on declaring arrays and reading and writing their elements. Starts at the 1:26:29 mark.

02

Arrays in C Programming Explained

Simplilearn's beginner tutorial on arrays in C: what they are, how to declare and initialize them, and how to use them in programs.

03

2D Arrays & Nested Loops

The freeCodeCamp chapter on two-dimensional arrays and looping through them with nested loops. Starts at the 2:59:05 mark.

04

Null-Terminated Strings and Their Pitfalls

An introduction to how C strings end with a null terminator, why that design is considered unsafe, and the common errors and solutions.

05

String Library Functions

C Tutorial 22: the common string.h functions for getting the length of a string, copying it, joining strings, and comparing them: strlen, strcpy, strcat, and strcmp.