char arr[m][n];
Where m and n represent the number of rows and columns of a two-dimensional array, respectively.
If you want to use s to enter a two-dimensional character array, you can use the following code:
scanf("%s ",arr[I]);
Where i represents the row subscript of a two-dimensional array.
You can also use the following code to realize the S input of a two-dimensional character array:
for(int j = 0; j & ltn; j++) {
scanf(" %c ",& amparr[I][j]);
}
Where j represents the column subscript of a two-dimensional array.
It should be noted that when using the scanf function to input a character array, spaces should be added so that the scanf function can correctly identify the input string.
For example, if you want to enter a two-dimensional character array with 3 rows and 4 columns, you can use the following code:
Character arrangement [3] [4];
for(int I = 0; I<3; i++) {
scanf("%s ",arr[I]);
}
or
Character arrangement [3] [4];
for(int I = 0; I<3; i++) {
for(int j = 0; j & lt4; j++) {
scanf(" %c ",& amparr[I][j]);
}
}
So you can use s to enter a two-dimensional character array.