I have a stack that contains two types of struct. Struct Stud and Struct Prof. When I want to push something I created two Push functions for both structs. Although I would like it to be with one function but its ok I can bear with it.
Now to Pop. If I want to Pop a student from the Stack, do I have to make a Pop function specifically for Students only? The same with Professors?
How can I store the item if I don't know what type is it? What type must the element be, to store the item there?
Here are the structs:
struct MyStack
{
    int head;
    void **stack;
    int size;
};
typedef struct MyStack STACK;
struct stud
{
    char flag;
    char fname[50];
    int semester;
};
struct prof
{
    char flag;
    char fname[50];
    char course[30];
};
Now to create the Pop function. What do type of item do I pass in the function?
int Pop(STACK *stack,int *head,??? *elem)
{
if(stack->head<=-1)
    return 0;
*elem=stack->stack[*head];
*head--;
return 1;
}
 
     
    