【发布时间】:2020-07-23 10:47:26
【问题描述】:
你能帮我写代码吗?我想将我的文本文件逐行转换为二维字符串。我尝试了一些条件,但没有成功。
m - 行数
n - 列数
这是我的功能:
int convert_text_file_into_2Dstring(int m, int n)
{
int i, j;
int **string= (char **)malloc(m * sizeof(char *));
for (i=0; i<n; i++)
string[i] = (char *)malloc(n * sizeof(int));
for(i=0; i<n; i++){
for(j=0; j< m){
...
}
}
}
【问题讨论】:
-
没有什么能比得上二维字符串。我明白你想要什么,但你应该更正你的措辞(也是函数的标识符)。
标签: c string file multidimensional-array text-files