24.4k views
23 votes
g 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

User Bismo
by
4.3k points

1 Answer

7 votes

Answer:

Declare it as: char str[5][100]

Step-by-step explanation:

The attachment completes the question

The options in the attachment shows that the programming language being described is more likely to be C language.

In C language, the following syntax is used to store an array of m number of strings and a maximum of n elements in each string,

char array-name[m][n]

From the question:


m = 5


n = 100

Let array-name be str.

The array will be declared as: char str[5][100]

g A string is represented as an array of characters. If you need to store an array-example-1
User Mark Plotnick
by
3.9k points