Sample Video Frame

Created by Zed A. Shaw Updated 2024-11-15 13:50:32
 

Exercise 12: Sizes and Arrays

In the last exercise, you did math but with a '\0' (nul) character. This may seem odd coming from other languages, since they try to treat strings and byte arrays as different beasts. C treats strings as just arrays of bytes, and it's only the different printing functions that recognize a difference.

Before I can really explain the significance of this, I have to introduce a couple more concepts: sizeof and arrays. Here's the code we'll be talking about:

View Source file ex12.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.