...

/

Memory Representation Using Char Arrays

Memory Representation Using Char Arrays

Get introduced to strings in C from a memory point of view.

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.

Access this course and 1400+ top-rated courses and projects.