Linked list, passing a pointer
-
I have this C++ course and I have creatd a linked list with methods to insert and remove. The program works fine for me but for my instructor it crashes, for him, most likely since he uses his version of main. I can't trobleshoot my version, that easy, since it works. What I suspect is that my remove method wants an actual parameter of a pointer that points to a real address,(not null) and perhaps my instructors main is only sending a pointer. Is it possible to send a pointer, (of a user defined data type UDT) to a method and have that method set what this calling parameter will point to? I hope this makes sense. I have been spending many hours trying to learn all the ins and outs of pointers. Thanks If only I had more time!
-
I have this C++ course and I have creatd a linked list with methods to insert and remove. The program works fine for me but for my instructor it crashes, for him, most likely since he uses his version of main. I can't trobleshoot my version, that easy, since it works. What I suspect is that my remove method wants an actual parameter of a pointer that points to a real address,(not null) and perhaps my instructors main is only sending a pointer. Is it possible to send a pointer, (of a user defined data type UDT) to a method and have that method set what this calling parameter will point to? I hope this makes sense. I have been spending many hours trying to learn all the ins and outs of pointers. Thanks If only I had more time!
Have you tried passing bad values to your methods. Like trying to remove the same element more than one time? If you remove all emements in your main does it crash? bitsNbites wrote: I hope this makes sense. Not fully. John
-
I have this C++ course and I have creatd a linked list with methods to insert and remove. The program works fine for me but for my instructor it crashes, for him, most likely since he uses his version of main. I can't trobleshoot my version, that easy, since it works. What I suspect is that my remove method wants an actual parameter of a pointer that points to a real address,(not null) and perhaps my instructors main is only sending a pointer. Is it possible to send a pointer, (of a user defined data type UDT) to a method and have that method set what this calling parameter will point to? I hope this makes sense. I have been spending many hours trying to learn all the ins and outs of pointers. Thanks If only I had more time!
Did you compile and run under Debug mode? And your instructor built and run in Release mode? Regards Senthil _____________________________ My Blog | My Articles | WinMacro