We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 34b90f5 commit 0bf48a0Copy full SHA for 0bf48a0
dynamic_node.cpp
@@ -9,13 +9,24 @@ class Node
9
Node(int val)
10
{
11
this->val = val;
12
+ this->next = NULL;
13
}
14
};
15
16
int main()
17
18
+ /* Static Node */
19
+ // Node head(10);
20
+
21
+ /* Dynamic Node */
22
Node *head = new Node(10);
23
Node *a = new Node(20);
24
+ head->next = a;
25
26
+ cout << head->val << endl;
27
+ cout << a->val << endl;
28
+ cout << head->next->val << endl;
29
+ cout << (*(*head).next).val << endl;
30
31
return 0;
32
dynamic_node.exe
50.5 KB
0 commit comments