Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Linked list, passing a pointer

Linked list, passing a pointer

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structuresquestionannouncementlearning
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bitsNbites
    wrote on last edited by
    #1

    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!

    J S 2 Replies Last reply
    0
    • B bitsNbites

      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!

      J Offline
      J Offline
      John M Drescher
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • B bitsNbites

        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!

        S Offline
        S Offline
        S Senthil Kumar
        wrote on last edited by
        #3

        Did you compile and run under Debug mode? And your instructor built and run in Release mode? Regards Senthil _____________________________ My Blog | My Articles | WinMacro

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups