Here I am posting stack programming singly link list.
From here you can learn it. It will help you to find your mistake in your programe.

Code:
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
#include<string.h>

class link_stack
    
{

    struct node
    
    {

        int id;

        char name[10];

        node *next;

    };

    node *top,*x,*ptr;

    public:

        link_stack()

        {

            top=x=ptr=NULL;

        }

        void push()

        {

            x=new node;

            cout << "Enter an ID number and name: ";

            cin >> x->id >> x->name;


            x->next=top;

            top=x;

        }

        int pop(char n[])

                {    int result;

                        if(top==NULL)

                                cout<<"\nStack is Empty";

                        else

                        {    result = top->id;
                                
                                strcpy(n, top->name);

                                x=top;

                                top=top->next;

                                delete x;

                                return result;

                        }

                }

        void empty()
{

                 char name[10];
                            
                         while(!obj.empty())
                                        
                         {

                                cout << pop(name) << ": " << name << endl;

                          }

                 }
            
};

void main()

{

    link_stack obj;

    int choice;

    do

    {

        cout << "\n ----------MENU---------- \n";

        cout << "1.Push\n"
            
                        <<  "2.Pop\n"
               
                        <<  "3.Exit";

                 cout << "\nEnter your choice: ";

        cin>>choice;

        switch(choice)

        {

        case 1: obj.push();

            break;

        case 2: obj.pop();

        obj.empty();

            break;

        case 3: cout << endl;

        }

    }

    while (choice!=3);

    getch();

}