I got 2 structs,a pointer to each struct and a void **stack which points to the pointers of the structs.
my problem is at the line
(*ptr2+*a)=(struct student *)malloc(sizeof(struct student));
*a is a variable that increases by 1 everytime a stud registration happens so i don't allocate memory for the same address over and over again
since i send the address of stud(&stud) at the menu function and then at the input function
*ptr2==stud 
thus
stud[*a]== *(stud+*a)== *(*ptr2+*a)
why is (*ptr2+*a) on the left side of malloc wrong?
part of the code
struct student
{
    char flag;
    char surname[256];
    int semester;
};
main()
{
    ...
    struct student *stud;
    menu(stack,stackcopy,reversedstack,&prof,&stud,stacksize,&head);
    ...
}
void menu(void **stack,void **stackcopy,void **reversed,struct professor **ptr1,struct student **ptr2,int size,int *head)
{
    ...
    input(stack,ptr1,ptr2,size,head,&a,&b);
    ...
}
int input(void **stack,struct professor **ptr1,struct student **ptr2,int size,int *head,int *a,int *b)
{
            ...
            done=Push(stack,head,(*(int *)ptr2+*a),size);
            (*ptr2+*a)=(struct student *)malloc(sizeof(struct student));
            stud_input(ptr2,a);
            ...
}
 
     
     
    