Sample Video Frame

Created by Zed A. Shaw Updated 2024-12-10 18:57:40
 

Exercise 13: For-Loops and Arrays of Strings

You can make an array of various types with the idea that a string and an array of bytes are the same thing. The next step is to do an array that has strings in it. We'll also introduce your first looping construct, the for-loop, to help print out this new data structure.

The fun part of this is that there's been an array of strings hiding in your programs for a while now: the char *argv[] in the main function arguments. Here's code that will print out any command line arguments you pass it:

View Source file ex13.c Only

Previous Lesson Next Lesson

Register for Learn C the Hard Way

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.