[英]C++ about pointer used
int main()
{
int rows=0;
int studId,course;
char ch;
while(FileIn>>studId>>course)
{
for(int i=0;i<5;i++)
{
FileIn>>ch;
}
rows++;
}
char** questions = new char*[rows];
What is the meaning of new char*[rows]
? new char*[rows]
是什么意思? if rows = 10.如果行数 = 10。
The file content is文件内容是
20 1 A B C D E
20 1 A B C D E
20 1 A B C D E
20 1 A B C D E
20 1 A B C D E
20 1 A B C D E
20 1 A B C D E
20 1 A B C D E
20 1 A B C D E
20 1 A B C D E
分配一个包含 10 个“char*”类型元素的数组。
since 'questions' is double pointer, it is made to point an array of pointers of size rows using new char*[rows] that is, after char** questions = new char*[rows];, questions can be made to point to pointers of type char.由于 'questions' 是双指针,因此使用 new char*[rows] 指向一个大小为行的指针数组,即在 char** questions = new char*[rows]; 之后,问题可以指向指向 char 类型的指针。 Hope I answered your question.希望我回答了你的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.