void com() {
struct TTT {
char isDup[10];
char readData[10];
struct TTT* link[9];
};
struct TTT case1;
char* data;
data = read();
for (int i = 0; i < 9; i++) {
case1.readData[i] = data[i];
case1.isDup[i] = data[i];
}
case1.readData[9] = '\0';
case1.isDup[9] = '\0';
for (int i = 0; i < 9; i++)
for (int j = 0; j < 10; j++)
*case1.link[i]->readData[j] = case1.readData[j];*
for (int i = 0; i < 9; i++)
for (int j = 0; j < 9; j++)
{
if (case1.isDup[j] == '0')
{
case1.isDup[j] = '2';
case1.link[i]->readData[j] = '2';
i++; j = 0;
}
}
}
There's an error *case1.link[i]->readData[j] = case1.readData[j];*
An error occurred while reading the character in the string in this part. That's the error
There are several pointers that point to an array, so we need an array of pointers.
Each pointer points to an array.
How can I modify it to do that?
I'm sorry for the insufficient question
I don't think I can give you a definite solution, but...
Based on my poor coding skills, it could be a bit dangerous.
If you look at the top,
struct TTT {
char isDup[10];
char readData[10];
struct TTT* link[9];
};
If you look at the code,
Create a structure called TTT (declaration?),
On top of that, you have a TTT like yourself as a member variable.
This is a very recursive structure
If you write it like this,
The fact that the member variable of the structure TTT has a nine-space array such as TTT (self).
In that arrangement, again and again
It's like this.
In a structure called TTT
Black is isDup[10]
and readData[10]
;
Red is link
with TTT, which is itself, as a member array variable (?) in the structure TTT.
I'm not a developer in the field, I'm a student.
I wonder if there's any reason to have this kind of structure. (I'm sure there is, right?))
If you look at the c++ debugger in Visual Studio 2017, if you go above link (double) of link,
Unable to read memoryThe word
appears.
Like this...
It has a very strange structure.
I can't give you fancy, fancy solutions and code like those in the field, but...
I wrote down my answer with my sincere heart.
© 2024 OneMinuteCode. All rights reserved.