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. Pointer to object doesn't point to any thing !!!!!!

Pointer to object doesn't point to any thing !!!!!!

Scheduled Pinned Locked Moved C / C++ / MFC
data-structures
7 Posts 5 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.
  • O Offline
    O Offline
    OmarSH
    wrote on last edited by
    #1

    hello every body : i just want to under

    stand what the pointer in linked list point to ,it is a object pointer but it seems to me that it doesn't point to any thing

    class LList
    {
    private:
    struct ListNode // Declare a structure for the list { float var1;
    int var2;
    ListNode *next; };
    ListNode *head; // List head pointer
    public:
    LList( void ) { head = NULL; } // Constructor
    ~LList( void ); // Destructor
    void appendNode( float , int );
    void insertNode( float , int );
    void deleteNode( float , int ); void displayList( void );
    };

    J L C 3 Replies Last reply
    0
    • O OmarSH

      hello every body : i just want to under

      stand what the pointer in linked list point to ,it is a object pointer but it seems to me that it doesn't point to any thing

      class LList
      {
      private:
      struct ListNode // Declare a structure for the list { float var1;
      int var2;
      ListNode *next; };
      ListNode *head; // List head pointer
      public:
      LList( void ) { head = NULL; } // Constructor
      ~LList( void ); // Destructor
      void appendNode( float , int );
      void insertNode( float , int );
      void deleteNode( float , int ); void displayList( void );
      };

      J Offline
      J Offline
      Jonathan Davies
      wrote on last edited by
      #2

      Within your

      struct ListNode

      I would expect a

      ListNode* pNext

      and another

      ListNode* pPrev

      which must be set by one of the methods called on an instance of your

      LList

      to point to the next and previous structures in the list. They don't point to anything to start with, it's only when you add one to a list that they are used - they are the links in the linked list.

      1 Reply Last reply
      0
      • O OmarSH

        hello every body : i just want to under

        stand what the pointer in linked list point to ,it is a object pointer but it seems to me that it doesn't point to any thing

        class LList
        {
        private:
        struct ListNode // Declare a structure for the list { float var1;
        int var2;
        ListNode *next; };
        ListNode *head; // List head pointer
        public:
        LList( void ) { head = NULL; } // Constructor
        ~LList( void ); // Destructor
        void appendNode( float , int );
        void insertNode( float , int );
        void deleteNode( float , int ); void displayList( void );
        };

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        This is a class definition, so it merely describes the parts of the class. You need to write the implementation of each function which will manage the pointers.

        Use the best guess

        1 Reply Last reply
        0
        • O OmarSH

          hello every body : i just want to under

          stand what the pointer in linked list point to ,it is a object pointer but it seems to me that it doesn't point to any thing

          class LList
          {
          private:
          struct ListNode // Declare a structure for the list { float var1;
          int var2;
          ListNode *next; };
          ListNode *head; // List head pointer
          public:
          LList( void ) { head = NULL; } // Constructor
          ~LList( void ); // Destructor
          void appendNode( float , int );
          void insertNode( float , int );
          void deleteNode( float , int ); void displayList( void );
          };

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #4

          Like any other uninitialized variable, an uninitialized pointer contains garbage (or, in other words, points to garbage). In the shown code, head is initialized with NULL to mark the list as empty, it is responsibility of appendNode (or insertNode) implementation to allocate a fresh ListNode and make head pointing to it.

          Veni, vidi, vici.

          S 1 Reply Last reply
          0
          • C CPallini

            Like any other uninitialized variable, an uninitialized pointer contains garbage (or, in other words, points to garbage). In the shown code, head is initialized with NULL to mark the list as empty, it is responsibility of appendNode (or insertNode) implementation to allocate a fresh ListNode and make head pointing to it.

            Veni, vidi, vici.

            S Offline
            S Offline
            sarvanik
            wrote on last edited by
            #5

            i saw ur name in top experts Great.! i've a question and i posted it in forum but i didnt get correct answer so i want too ask u that question as u r an expert please give me answer sorry for writing here i'm waiting for ur reply Thanks in advance HOW TO WRITE SQL QUERY IN XML? please explain about it i seen an article in this forum but it not help me lot of errors in it Thanks in advance

            S 1 Reply Last reply
            0
            • S sarvanik

              i saw ur name in top experts Great.! i've a question and i posted it in forum but i didnt get correct answer so i want too ask u that question as u r an expert please give me answer sorry for writing here i'm waiting for ur reply Thanks in advance HOW TO WRITE SQL QUERY IN XML? please explain about it i seen an article in this forum but it not help me lot of errors in it Thanks in advance

              S Offline
              S Offline
              sarvanik
              wrote on last edited by
              #6

              i'm waiting for ur response ---CPallini

              C 1 Reply Last reply
              0
              • S sarvanik

                i'm waiting for ur response ---CPallini

                C Offline
                C Offline
                CPallini
                wrote on last edited by
                #7

                Actually I'm not an expert, neither of SQL nor of XML. However you may store data both in databases and in XML files, each method having its pros and cons. Typically you query for data in databases using SQL, while use XPath for finding them in XML files. If you are interested in using XML files as data storage then you may find many many tutorial available on the web, just use Google.

                Veni, vidi, vici.

                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