Array of Strings in C || Lesson 70 || C Programming || Learning Monkey ||
Learning Monkey Learning Monkey
57.7K subscribers
16,121 views
281

 Published On Jul 21, 2021

The array of Strings in C

In this class, we will try to understand the Array of Strings in C.

We have already covered the concepts on strings in our previous classes.
Array of Strings

In C, we have a provision to create an array of strings.

So far, in our previous classes, we have seen how to create a string (an array of characters).

An array of strings is an array with more than one string.

As we have already that we can create an array of arrays by declaring a two-dimensional array.

In the same way, we can create an array of strings by using a two-dimensional array.


The image is the program to understand the concept of an array of strings.


The second line in the above code is the declaration of an array of strings.

In the above declaration, we have created an array of four strings

If the initialization is done in the declaration, there is no need to declare rows, and the compiler automatically took those rows.

The program is to find the planets whose names start with ‘M’.

In our example, we have two planets, Mercury and Mars.

We have used the rows and columns to access a specific character in the string in the if condition.

If the character is equal to ‘M,’ then we will print the entire string.

To access the entire string, we have to use only the row number.

To access a character in the string, we have to use both row and column numbers.


In the above example, we have initialized the array, but we will allow the user to enter the details in this example.


The first for loop in the above example is to allow the user to give the string inputs.

The remaining part of the program is the same as the above example.


#learningmonkey #cprogrammingforbeginners #placements #gatecse #cprogramming #cprogramminglanguage





Link for playlists:
   / @learningmonkey  


Link for our website: https://learningmonkey.in

Follow us on Facebook @   / learningmonkey  

Follow us on Instagram @   / learningmonkey1  

Follow us on Twitter @   / _learningmonkey  

Mail us @ [email protected]

show more

Share/Embed