Memory Representation Using Char Arrays

Introduction

In C, we represent strings using char arrays. Therefore, everything we discussed in the “Pointers And Arrays” chapter holds for this chapter.

However, a few things are specific to character arrays, which we’ll now discuss.

In this chapter, we’ll refer to character arrays as strings.

First code with char arrays

Let’s use the ARRAY_SIZE macro with a character array and see if we can deduce its number of elements.

Moreover, let’s also print the string’s size in bytes.

Get hands-on with 1200+ tech skills courses.