Edit: I've found the error: I did not start an array with one size question could be closed is.
I have a square V
and the second class is N
. An object of N
will contain an array of objects in the class V
(say V ** vList
). So, there is a function like N
V ** getList ();
Now in some functions of other classes or just a driver function, if I say V ** TheList = (N) n.getList ();
Q1: theList
will be pointing to the first element of the array? Given that the size of the array is known, can I loop through the index i
and say V * oneV = * vList [i]
? Please correct me if I am doing it is wrong.
I am using the debugger to find out through the whole process of running my program, the thing I found was that V * oneV = vList [i]
, the values of pointers in the array were the same, vList
were identical, when they were created, but if I follow the indicator, where it is, pointing out that the object was gone. I am guessing that this may be the reason why I am getting a mistake or just getting the error, can this be the case? Why was the object 'loosened' on the other end of the pointer? what I have done?
And yes, I'm working on school work, so I do not want to print my code, I want to finish it myself, but I need help finding a problem. It seems that there is still a need for clarification on the array of signals. I would like to thank
Question 1 is correct second part For, V * oneV = vList [i]
will be the correct syntax once in your syntax (one object type
Edit: Since you will use the correct syntax, the reason for segfaults will depend on your memory management of types of objects V
If you have stacks (automated wars, No entries in the objects created on the new
or malloc
and if you are trying to get it outside the outside, the indicators may be hanging and your code crashes. Will go
No comments:
Post a Comment