109k views
18 votes
A string is represented as an array of characters. If you need to store an array of 5 strings with the maximum length of a string is 100, how would you declare it

1 Answer

9 votes

Answer:

char str[5][100]

Step-by-step explanation:

See attachment for options:

From the options, we can see that the programming language is C language.

The syntax to store an array of m strings with a maximum of n elements in C is:

char array-name[m][n]

In this case:


m = 5 --- Number of strings in the array


n = 100 --- Maximum character in each string

Assume the array name is str, the syntax can be expressed as:

char str[5][100]

A string is represented as an array of characters. If you need to store an array of-example-1
User MikZuit
by
5.4k points