copy string into a structure
all i am trying to do here is to copy a string input given by user into an arry decleared inside a structure.but my code is not working. anyone please explain to me why this code isnt working
#include<stdio.h>
#include<string.h>
typedef struct{
int count;
char name[20];
}student;
int main()
{
student *p;
p=(student *)malloc(sizeof(student));
char input_name[20];
gets(input_name);
strcpy(p->name[(p->count)++],input_name);
printf("%s",p->name[(p->count)++]);
getch();
}