I have a void array and i want inside it to enter structs.
No i don't mean something like that :
struct pinx
{
int n;
};
struct pinx *array;
I want a dynamic array like that :
struct data
{
void **stack;
}exp1;
To have as members multiple structs like these structs:
struct student
{
char flag;
char name[50];
int sem;
};
struct prof
{
char flag;
char name[50];
int course;
};
Flag is used for telling the program if the array in that specific position has a struct from stud or prof.
Also an image to make it more clear for you.

I tried to connect the array with structs by declaring an array to both of the structs but it doesn't work for both only for one struct.
struct student *student_array;
struct prof *prof_array;
exp1.stack = (void *)student_array;
exp1.stack = (void *)prof_array;
exp1.stack[0] = (void *)student_array;Although, using a union like it is explained in the answer below is better, specially for identical size structures.