[英]How to store words from a file in a two dimensional array in C
I am trying to read a file like:我正在尝试读取如下文件:
mother mama, father papa, apple mar, ...妈妈妈妈,爸爸爸爸,苹果玛尔,...
And I would like to store those words in an array of chars A[10][2][12] so the words: "mother" will be in A[0][0] "father" in A[1][0] but the second column: "mama" in A[0][0] "papa" in A[0][1]... I can change the format of the words in the file,I can write them without comma or maybe with something else, I now how to read the word character by character and store them in an array ,but have no idea how to store those pairs in a two dimensional array!!我想将这些单词存储在字符数组 A[10][2][12] 中,这样的话:“母亲”将在 A[0][0] “父亲”在 A[1][0 ] 但是第二列:A[0][0] 中的“mama” A[0][1] 中的“papa”...我可以更改文件中单词的格式,我可以不用逗号或也许还有别的东西,我现在如何逐个字符地读取单词并将它们存储在一个数组中,但不知道如何将这些对存储在一个二维数组中! Appreciate any help or hints)
感谢任何帮助或提示)
regarding;关于;
"mother" will be in A[0][0] "father" in A[1][0] but the second column: "mama" in A[0][0] "papa" in A[0][1] “母亲”将在 A[0][0] 中 “父亲”在 A[1][0] 但第二列:“妈妈”在 A[0][0] “爸爸”在 A[0][1 ]
That will not work.那不管用。 Suggest:
建议:
"mother" will be in A[0][0] "father" in A[1][0]. “母亲”将在 A[0][0] 中,“父亲”在 A[1][0] 中。 "mama" in A[0][1] "papa" in A[1][1]
A[0][1] 中的“妈妈” A[1][1] 中的“爸爸”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.