Arrays of Strings
Let's learn how to make an array of strings using pointers.
We'll cover the following
We have seen that strings are just arrays of characters, terminated by a null character. We have also seen that the variables that hold strings (like arrays of other types, e.g. int
or double
) are actually pointers to the head of the array.
Using an array of pointers
We can use an array of pointers, where each pointer points to the head of a character array (in other words a string), to store an array of strings. Here’s a coding example:
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy