Skip to content

Commit 138a66c

Browse files
authored
singly linked list
Node creation in singly Linked List using c++
1 parent eb1406b commit 138a66c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

createnode.cpp

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include<iostream>
2+
using namespace std;
3+
class Node
4+
{
5+
public:
6+
int data;
7+
Node* next;
8+
};
9+
int main()
10+
{
11+
Node* head=NULL;
12+
Node* second=NULL;
13+
Node* third=NULL;
14+
15+
head = new Node();
16+
second = new Node();
17+
third = new Node();
18+
19+
head->data=1;
20+
head->next=second;
21+
22+
second->data=2;
23+
second->next=third;
24+
25+
third->data=3;
26+
third->next=NULL;
27+
}

0 commit comments

Comments
 (0)