OK, so I edited my code, but I still have two problems :
But here's my code first :
    #include <iostream>
using namespace std;
struct stack
{
    int data[5];
    int top;
};
void push (int a, stack &S)
{
    S.top++;
    if (S.top<5)
    {
        S.data[S.top]=a;
    }
    else cout<<"Stack is full!!!"<<endl; S.top--;
}
int pop(stack &S)
{
    if (S.top==-1)
    {
        cout<<"Stack is empty!"<<endl;
    }
    else
    {
        int temp=S.data[S.top];
        S.data[S.top]=NULL;
        S.top--;
        return temp;
    }
}
bool isEMPTY(stack &S)
{
    if (S.top==-1)
        return true;
    else return false;
}
bool isFULL(stack &S)
{
    if (S.top==5)
        return true;
    else return false;
}
int main()
{
    stack S = { {}, -1 };
    push(5,S); cout<<"5 is pushed \n"<<endl;
    push(3,S); cout<<"3 is pushed \n"<<endl;
    push(1,S); cout<<"1 is pushed \n"<<endl;
    push(2,S); cout<<"2 is pushed \n"<<endl;
    push(6,S); cout<<"6 is pushed \n"<<endl;
    push(7,S); cout<<"7 is pushed \n"<<endl;
    cout<<pop(S)<<"is popped\n"<<endl;
    cout<<pop(S)<<"is popped\n"<<endl;
    cout<<pop(S)<<"is popped\n"<<endl;
    return 0;
}
So, the first problem is, when I pop I get a "Totally random value" and it's not like LIFO.
Second is, I actually intended on inserting 6 values, when I already had the max value = 5, so the output actually showed me the 6 values.
 
     
     
     
     
    