Web Analytics Made Easy -
StatCounter C++ Pointers - CodingForum

Announcement

Collapse
No announcement yet.

C++ Pointers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • C++ Pointers

    Trying to understand a program containing structures and pointers. I find pointers difficult to understand.

    Here is a piece of a program I am studying. The parts that confuse me i placed in bold. The two items on bottom I assume refer to functions and are passing pointers but i dont understand the "NODE*" part and i cant seem to find a reference anywhere like it. And of course the other bold selected in the struct.

    Code:
    struct Node
    {
    	char fname[NAME_SIZE];
    	char lname[NAME_SIZE];
    	char ssn[SSN_SIZE];
    	[B]Node* next;[/B]
    };
    void searchNode(Node*,char*);
    [B]Node* buildList(void);
    Node* insertNode(Node*,Node*);[/B]
    ALSO:
    To make sure I am also understanding this.
    Am i right in assuming this is initializing to value 0?
    Code:
    Node* head=(Node*)0;
    Can someone explain it to me?

  • #2
    The "Node*" in front of each of the function definitions says that they will be returning a pointer to a Node structure.

    And yes, initializing to zero, or maybe more accurately the address zero.

    Dave

    Comment


    • #3
      Understand C++ Pointers

      Use of pointers requires far more than syntax understanding. Requires expertise only time will give you.


      This explanation, pretty simple
      Don't forget to mark solution providing post as "Answered".
      It helps others to find correct solutions!

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎