Home > Back-end >  inquire
inquire

Time:06-08

How to input in the C language multiline strings, each and every line of string of characters stored in different array,

CodePudding user response:

2 d character array,,,,

CodePudding user response:

Typedef char String [20]
Char a [20]
Char [20] b
String c [2]={a, b}
C [0], c [1]

CodePudding user response:

reference 1st floor qq_45798109 response:
2 d character array,,,,

Want to know how to write the code

CodePudding user response:

reference BuaaFrancisco reply: 3/f
Quote: refer to 1st floor qq_45798109 response:
2 d character array,,,,

Would like to know how to write the code

Compare my commented out and didn't comment out a little difference, look yourself run
 # include & lt; stdio.h> 
Int main () {
Int the row, col.//the row that you input the number of rows, col is greater than all the characters in a line number
The scanf (" % d % d ", & amp; The row, & amp; Col);
Char a, [row] [col].
Getchar ();
for (int i=0; I & lt; The row. + + I) {
The scanf (" % s ", & amp; A [I]);//a newline, Spaces, TAB end
//gets a [I]);//meet a newline FuCai end
}
for (int i=0; I & lt; The row. + + I) {
Printf (" % s \ n ", & amp; A [I]);
//puts (a [I]);
}
return 0;
}

CodePudding user response:


I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html