how to make array of strings in c code example
Example 1: 2d array of strings in c
language[0] => "Java";
language[1] => "Python";
language[2] => "C++";
language[3] => "HTML";
language[4] => "SQL";
Example 2: 2d array of strings in c
// it is valid
char language[ ][10] = {"Java", "Python", "C++", "HTML", "SQL"};
Example 3: array of strings in c
char ch_arr[3][10] = {
{'s', 'p', 'i', 'k', 'e', '\0'},
{'t', 'o', 'm','\0'},
{'j', 'e', 'r', 'r', 'y','\0'}
};
Example 4: create array of strings in c from user input
#include <stdio.h>
int main()
{
char str[5][10];
printf("enter the strings...\n");
for(int i =0; i < 5; i++)
scanf("%s", str[i]);
printf("All strings are...\n");
for(int j =0; j < 5; j++)
printf("%s\n", str[j]);
}