Skip to content

Instantly share code, notes, and snippets.

@easleyschool
Created October 11, 2019 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save easleyschool/3080463f2cd95958e69fca2699a3b0e1 to your computer and use it in GitHub Desktop.
Save easleyschool/3080463f2cd95958e69fca2699a3b0e1 to your computer and use it in GitHub Desktop.
void Stack::push(int d)
{
// creating a new node
node *temp;
temp = new node();
// setting data to it
temp->data = d;
// add the node in front of list
if(front == NULL)
{
temp->next = NULL;
}
else
{
temp->next = front;
}
front = temp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment