Skip to content

Instantly share code, notes, and snippets.

@miladabc
Created July 7, 2018 16:33
Show Gist options
  • Save miladabc/116592360a657ace7695811c646fa940 to your computer and use it in GitHub Desktop.
Save miladabc/116592360a657ace7695811c646fa940 to your computer and use it in GitHub Desktop.
Head Node Linked List
//Milad Abbasi
//06-07-2018
//Head Node Linked List
#include <iostream>
using namespace std;
struct Node
{
int data;
Node *next;
};
class HeaderLinkedList
{
Node *head;
public:
HeaderLinkedList()
{
head = new Node;
head->next = NULL;
}
void insertStart(int value)
{
Node *tmp = new Node;
tmp->data = value;
tmp->next = head;
head = tmp;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment