Summary: In this tutorial, we will learn to create an array of strings in C programming language.

C language has no ‘string’ datatype, so we usually store a string value as a set of characters in a char array.

The following is an example of how exactly a string is stored in C:

The above char array can store only one string value. How can we store multiples string values in C?

We can do so by creating an array of char array, like the following:

The above statement creates a string array which can store up to ‘size’ number of elements, each of length 30.

Here’s a C program, in which we’re storing 3 strings in an array and output the same:

Output:

String Array in C

In this tutorial, we learned to create an array of strings in the C programming language. Comment below if you know any other methods of storing strings in C.

Leave a Reply

7 + 18 =